[Libreoffice-commits] .: 3 commits - sw/inc sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Wed Dec 1 06:49:34 PST 2010
sw/inc/swcrsr.hxx | 11 ++++++++++-
sw/source/core/crsr/swcrsr.cxx | 6 +-----
sw/source/filter/ww8/docxattributeoutput.cxx | 26 +++++++++++++-------------
sw/source/ui/uiview/viewsrch.cxx | 10 ++--------
4 files changed, 26 insertions(+), 27 deletions(-)
New commits:
commit fb359000ba2ce5711727ebdbe8c838da3bf2c3bc
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Dec 1 15:49:10 2010 +0100
document SwCrsrSaveState usage
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index feea603..bc8dbdd 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -207,7 +207,8 @@ public:
BOOL bChgCrsr = TRUE );
BOOL IsNoCntnt() const;
- void RestoreSavePos(); // Point auf die SavePos setzen
+ /** Restore cursor state to the one saved by SwCrsrSaveState **/
+ void RestoreSavePos();
// TRUE: an die Position kann der Cursor gesetzt werden
virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const;
@@ -231,6 +232,13 @@ public:
};
+/**
+ A helper class to save cursor state (position). Create SwCrsrSaveState
+ object to save current state, use SwCursor::RestoreSavePos() to actually
+ restore cursor state to the saved state (SwCrsrSaveState destructor only
+ removes the saved state from an internal stack). It is possible to stack
+ several SwCrsrSaveState objects.
+**/
class SwCrsrSaveState
{
SwCursor& rCrsr;
@@ -239,6 +247,7 @@ public:
~SwCrsrSaveState() { rCrsr.RestoreState(); }
};
+// internal, used by SwCursor::SaveState() etc.
struct _SwCursor_SavePos
{
ULONG nNode;
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 71d7945..a360e99 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -169,13 +169,9 @@ BOOL SwCursor::IsSkipOverProtectSections() const
}
-// Sicher die aktuelle Position, damit ggfs. auf diese zurueck
-// gefallen werden kann. Die SavePos Objekte werden als Stack verwaltet,
-// damit das auch alles bei verschachtelten Aufrufen funktioniert.
// Das CreateNewSavePos ist virtual, damit abgeleitete Klassen vom Cursor
// gegebenenfalls eigene SaveObjecte anlegen und in den virtuellen
// Check-Routinen verwenden koennen.
-
void SwCursor::SaveState()
{
_SwCursor_SavePos* pNew = CreateNewSavePos();
@@ -2096,7 +2092,7 @@ BOOL SwCursor::MoveSection( SwWhichSection fnWhichSect,
nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
}
-void SwCursor::RestoreSavePos() // Point auf die SavePos setzen
+void SwCursor::RestoreSavePos()
{
if( pSavePos )
{
commit bfee54af9583479f6c56d0f8c867e0deed1efb61
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Dec 1 15:37:54 2010 +0100
use SwCrsrSaveState to save and restore cursor position
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index a230405..918e19e 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -285,11 +285,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
case SVX_SEARCHCMD_REPLACE_ALL:
{
SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
-
- // Fix for i#8288: "Replace all" should leave the cursor at the place it was
- // before executing the command, rather than at the site of the final replacement.
- // To do this take note of the current cursor position before replace all begins:
- SwPosition TmpPointPos = *pWrtShell->GetSwCrsr()->GetPoint();
+ SwCrsrSaveState aSaveCursor( *pWrtShell->GetSwCrsr());
if( !pSrchItem->GetSelection() )
{
@@ -309,10 +305,8 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
SwWait aWait( *GetDocShell(), TRUE );
pWrtShell->StartAllAction();
nFound = FUNC_Search( aOpts );
-
// i#8288: Now that everything has been replaced, restore the original cursor position.
- *(pWrtShell->GetSwCrsr()->GetPoint()) = TmpPointPos;
-
+ pWrtShell->GetSwCrsr()->RestoreSavePos(); // (position saved by SwCrsrSaveState above)
pWrtShell->EndAllAction();
}
commit 49549ec1540b4c00d4224b96d368120e6deca453
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Nov 29 18:51:34 2010 +0100
move w:lvlJc to the proper place inside w:lvl
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e8e3c8f..0ba6baa 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2523,19 +2523,6 @@ void DocxAttributeOutput::NumberingLevel( BYTE nLevel,
FSNS( XML_w, XML_val ), aFmt.getStr(),
FSEND );
- // justification
- const char *pJc;
- bool ecmaDialect = ( m_rExport.GetFilter().getVersion() == oox::core::ECMA_DIALECT );
- switch ( eAdjust )
- {
- case SVX_ADJUST_CENTER: pJc = "center"; break;
- case SVX_ADJUST_RIGHT: pJc = !ecmaDialect ? "end" : "right"; break;
- default: pJc = !ecmaDialect ? "start" : "left"; break;
- }
- m_pSerializer->singleElementNS( XML_w, XML_lvlJc,
- FSNS( XML_w, XML_val ), pJc,
- FSEND );
-
// suffix
const char *pSuffix = NULL;
switch ( nFollow )
@@ -2577,6 +2564,19 @@ void DocxAttributeOutput::NumberingLevel( BYTE nLevel,
FSNS( XML_w, XML_val ), OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr(),
FSEND );
+ // justification
+ const char *pJc;
+ bool ecmaDialect = ( m_rExport.GetFilter().getVersion() == oox::core::ECMA_DIALECT );
+ switch ( eAdjust )
+ {
+ case SVX_ADJUST_CENTER: pJc = "center"; break;
+ case SVX_ADJUST_RIGHT: pJc = !ecmaDialect ? "end" : "right"; break;
+ default: pJc = !ecmaDialect ? "start" : "left"; break;
+ }
+ m_pSerializer->singleElementNS( XML_w, XML_lvlJc,
+ FSNS( XML_w, XML_val ), pJc,
+ FSEND );
+
// indentation
m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
if( nListTabPos != 0 )
More information about the Libreoffice-commits
mailing list