[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Noel Grandin
noel at peralex.com
Fri Oct 10 00:33:01 PDT 2014
sw/inc/PostItMgr.hxx | 6 +-----
sw/inc/SwAppletImpl.hxx | 12 +++++++-----
sw/source/filter/html/SwAppletImpl.cxx | 30 +++++++++++++++---------------
sw/source/filter/html/htmlplug.cxx | 8 ++++----
sw/source/filter/xml/xmltexte.cxx | 12 ++++++------
sw/source/uibase/docvw/PostItMgr.cxx | 11 +++--------
6 files changed, 36 insertions(+), 43 deletions(-)
New commits:
commit f453dc0327535056c8c9908c322763db9eca33be
Author: Noel Grandin <noel at peralex.com>
Date: Fri Oct 10 08:55:04 2014 +0200
convert SWHTML_OPTTYPE #defines to enum
Change-Id: I847c7c116984817c7d66d44431db0601f0a27209
diff --git a/sw/inc/SwAppletImpl.hxx b/sw/inc/SwAppletImpl.hxx
index dcd5a26..5a668be 100644
--- a/sw/inc/SwAppletImpl.hxx
+++ b/sw/inc/SwAppletImpl.hxx
@@ -22,10 +22,12 @@
#include <config_features.h>
-#define SWHTML_OPTTYPE_IGNORE 0
-#define SWHTML_OPTTYPE_TAG 1
-#define SWHTML_OPTTYPE_PARAM 2
-#define SWHTML_OPTTYPE_SIZE 3
+enum class SwHtmlOptType {
+ IGNORE = 0,
+ TAG = 1,
+ PARAM = 2,
+ SIZE = 3
+};
#include <com/sun/star/embed/XEmbeddedObject.hpp>
@@ -49,7 +51,7 @@ class SwApplet_Impl
OUString sAlt;
public:
- static sal_uInt16 GetOptionType( const OUString& rName, bool bApplet );
+ static SwHtmlOptType GetOptionType( const OUString& rName, bool bApplet );
SwApplet_Impl( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
SwApplet_Impl( SfxItemSet& rSet ): aItemSet ( rSet) {}
~SwApplet_Impl();
diff --git a/sw/source/filter/html/SwAppletImpl.cxx b/sw/source/filter/html/SwAppletImpl.cxx
index b95f544..eff1b23 100644
--- a/sw/source/filter/html/SwAppletImpl.cxx
+++ b/sw/source/filter/html/SwAppletImpl.cxx
@@ -38,9 +38,9 @@ static char const sHTML_O_Object[] = "OBJECT";
}
-sal_uInt16 SwApplet_Impl::GetOptionType( const OUString& rName, bool bApplet )
+SwHtmlOptType SwApplet_Impl::GetOptionType( const OUString& rName, bool bApplet )
{
- sal_uInt16 nType = bApplet ? SWHTML_OPTTYPE_PARAM : SWHTML_OPTTYPE_TAG;
+ SwHtmlOptType nType = bApplet ? SwHtmlOptType::PARAM : SwHtmlOptType::TAG;
switch( rName.toChar() )
{
@@ -48,67 +48,67 @@ sal_uInt16 SwApplet_Impl::GetOptionType( const OUString& rName, bool bApplet )
case 'a':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_align ) ||
rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_alt ) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
else if( bApplet &&
(rName.equalsIgnoreAsciiCaseAscii( sHTML_O_archive ) ||
rName.equalsIgnoreAsciiCaseAscii( sHTML_O_Archives )) )
- nType = SWHTML_OPTTYPE_TAG;
+ nType = SwHtmlOptType::TAG;
break;
case 'C':
case 'c':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_class ) ||
(bApplet && (rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_code ) ||
rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_codebase ))) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'H':
case 'h':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_height ) )
- nType = SWHTML_OPTTYPE_SIZE;
+ nType = SwHtmlOptType::SIZE;
else if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_hspace ) ||
(!bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SW_HTML_O_Hidden )) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'I':
case 'i':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_id ) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'M':
case 'm':
if( bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_mayscript ) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'N':
case 'n':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_name ) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'O':
case 'o':
if( bApplet && rName.equalsIgnoreAsciiCaseAscii( sHTML_O_Object ) )
- nType = SWHTML_OPTTYPE_TAG;
+ nType = SwHtmlOptType::TAG;
break;
case 'S':
case 's':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_style ) ||
(!bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_src )) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'T':
case 't':
if( !bApplet && rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_type ) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'V':
case 'v':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_vspace ) )
- nType = SWHTML_OPTTYPE_IGNORE;
+ nType = SwHtmlOptType::IGNORE;
break;
case 'W':
case 'w':
if( rName.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_width ) )
- nType = SWHTML_OPTTYPE_SIZE;
+ nType = SwHtmlOptType::SIZE;
break;
}
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index a33737b..a4e988f 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1164,8 +1164,8 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
{
const SvCommand& rCommand = aCommands[ --i ];
const OUString& rName = rCommand.GetCommand();
- sal_uInt16 nType = SwApplet_Impl::GetOptionType( rName, true );
- if( SWHTML_OPTTYPE_TAG == nType )
+ SwHtmlOptType nType = SwApplet_Impl::GetOptionType( rName, true );
+ if( SwHtmlOptType::TAG == nType )
{
const OUString& rValue = rCommand.GetArgument();
rWrt.Strm().WriteChar( ' ' );
@@ -1173,7 +1173,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
rWrt.Strm().WriteCharPtr( "=\"" );
HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ).WriteChar( '\"' );
}
- else if( SWHTML_OPTTYPE_PARAM == nType )
+ else if( SwHtmlOptType::PARAM == nType )
{
aParams.push_back( i );
}
@@ -1222,7 +1222,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
const SvCommand& rCommand = aCommands[ i ];
const OUString& rName = rCommand.GetCommand();
- if( SwApplet_Impl::GetOptionType( rName, false ) == SWHTML_OPTTYPE_TAG )
+ if( SwApplet_Impl::GetOptionType( rName, false ) == SwHtmlOptType::TAG )
{
const OUString& rValue = rCommand.GetArgument();
rWrt.Strm().WriteChar( ' ' );
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index b8ebe35..9198d7a 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -565,8 +565,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
while ( i > 0 )
{
beans::PropertyValue& aProp = aProps[--i];
- const sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
- if ( nType2 == SWHTML_OPTTYPE_TAG)
+ const SwHtmlOptType nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
+ if ( nType2 == SwHtmlOptType::TAG)
{
OUString aStr2;
aProp.Value >>= aStr2;
@@ -660,8 +660,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
while ( i > 0 )
{
beans::PropertyValue& aProp = aProps[--i];
- const sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
- if (SWHTML_OPTTYPE_PARAM == nType2 || SWHTML_OPTTYPE_SIZE == nType2 )
+ const SwHtmlOptType nType2 = SwApplet_Impl::GetOptionType( aProp.Name, true );
+ if (SwHtmlOptType::PARAM == nType2 || SwHtmlOptType::SIZE == nType2 )
{
OUString aStr;
aProp.Value >>= aStr;
@@ -686,8 +686,8 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
while ( i > 0 )
{
beans::PropertyValue& aProp = aProps[--i];
- const sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, false );
- if ( nType2 == SWHTML_OPTTYPE_TAG)
+ const SwHtmlOptType nType2 = SwApplet_Impl::GetOptionType( aProp.Name, false );
+ if ( nType2 == SwHtmlOptType::TAG)
{
OUString aStr;
aProp.Value >>= aStr;
commit 8ab1e7cdecc31c481ac5b28aab48fda4151577cf
Author: Noel Grandin <noel at peralex.com>
Date: Thu Oct 9 11:57:40 2014 +0200
only one value of the postit sort enum was being used
..so bin it
Change-Id: Iff6bad245a5fdd14fb785f7f5b3ca65ab51b742b
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index b7c7f05..1334ee4 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -60,10 +60,6 @@ class SwFrm;
namespace vcl { class Window; }
struct ImplSVEvent;
-#define SORT_POS 1
-#define SORT_AUTHOR 2
-#define SORT_DATE 3
-
#define COL_NOTES_SIDEPANE_ARROW_ENABLED RGB_COLORDATA(0,0,0)
#define COL_NOTES_SIDEPANE_ARROW_DISABLED RGB_COLORDATA(172,168,153)
@@ -187,7 +183,7 @@ class SwPostItMgr: public SfxListener
void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
void RemoveItem( SfxBroadcaster* pBroadcast );
- void Sort(const short aType);
+ void Sort();
public:
SwPostItMgr(SwView* aDoc);
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 5436622..ae46103 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -492,7 +492,7 @@ bool SwPostItMgr::CalcRects()
// show notes in right order in navigator
//prevent Anchors during layout to overlap, e.g. when moving a frame
- Sort(SORT_POS);
+ Sort();
// sort the items into the right page vector, so layout can be done by page
for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i)
@@ -1472,16 +1472,11 @@ void SwPostItMgr::Show()
LayoutPostIts();
}
-void SwPostItMgr::Sort(const short aType)
+void SwPostItMgr::Sort()
{
if (mvPostItFlds.size()>1 )
{
- switch (aType)
- {
- case SORT_POS:
- mvPostItFlds.sort(comp_pos);
- break;
- }
+ mvPostItFlds.sort(comp_pos);
}
}
More information about the Libreoffice-commits
mailing list