This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new feeb0b2648 Cleanup
feeb0b2648 is described below
commit feeb0b2648bd57ef12ff339bc8af4beeb2c15506
Author: mseidel <[email protected]>
AuthorDate: Sat May 31 23:41:50 2025 +0200
Cleanup
---
main/autodoc/source/parser/cpp/preproc.cxx | 276 +++++++-------
main/canvas/source/cairo/cairo_canvasfont.cxx | 278 +++++++-------
.../source/controller/main/CommandDispatch.cxx | 230 ++++++------
.../source/controller/main/UndoCommandDispatch.cxx | 154 ++++----
main/slideshow/source/engine/screenupdater.cxx | 415 ++++++++++-----------
5 files changed, 673 insertions(+), 680 deletions(-)
diff --git a/main/autodoc/source/parser/cpp/preproc.cxx
b/main/autodoc/source/parser/cpp/preproc.cxx
index e40a943afa..bf6bb9e6e5 100644
--- a/main/autodoc/source/parser/cpp/preproc.cxx
+++ b/main/autodoc/source/parser/cpp/preproc.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,22 +7,21 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
#include <precomp.h>
#include "preproc.hxx"
-
// NOT FULLY DEFINED SERVICES
#include <cosv/tpl/tpltools.hxx>
#include "all_toks.hxx"
@@ -30,31 +29,28 @@
#include <tools/tkpchars.hxx>
#include "c_rcode.hxx"
-
namespace cpp
{
-
PreProcessor::F_TOKENPROC PreProcessor::aTokProcs[PreProcessor::state_MAX] =
- {
- &PreProcessor::On_plain,
- &PreProcessor::On_expect_macro_bracket_left,
- &PreProcessor::On_expect_macro_param
- };
-
+ {
+ &PreProcessor::On_plain,
+ &PreProcessor::On_expect_macro_bracket_left,
+ &PreProcessor::On_expect_macro_param
+ };
PreProcessor::PreProcessor()
- : pCppExplorer(0),
- pSourceText(0),
- pCurValidDefines(0),
- // aTokens,
- eState(plain),
- pCurMacro(0),
- dpCurMacroName(0),
- // aCurMacroParams,
- aCurParamText(60000),
- nBracketInParameterCounter(0)
- // aBlockedMacroNames
+ : pCppExplorer(0),
+ pSourceText(0),
+ pCurValidDefines(0),
+ // aTokens,
+ eState(plain),
+ pCurMacro(0),
+ dpCurMacroName(0),
+ // aCurMacroParams,
+ aCurParamText(60000),
+ nBracketInParameterCounter(0)
+ // aBlockedMacroNames
{
}
@@ -64,160 +60,162 @@ PreProcessor::~PreProcessor()
void
PreProcessor::AssignPartners( CodeExplorer & o_rCodeExplorer,
- CharacterSource & o_rCharSource,
- const MacroMap & i_rCurValidDefines )
+ CharacterSource &
o_rCharSource,
+ const MacroMap &
i_rCurValidDefines )
{
- pCppExplorer = &o_rCodeExplorer;
- pSourceText = &o_rCharSource;
- pCurValidDefines = &i_rCurValidDefines;
+ pCppExplorer = &o_rCodeExplorer;
+ pSourceText = &o_rCharSource;
+ pCurValidDefines = &i_rCurValidDefines;
}
void
PreProcessor::Process_Token( cpp::Token & let_drToken )
{
- csv_assert(pCppExplorer != 0); // Implies pSourceText and
pCurValidDefines.
+ csv_assert(pCppExplorer != 0); // Implies pSourceText and
pCurValidDefines.
- (this->*aTokProcs[eState])(let_drToken);
+ (this->*aTokProcs[eState])(let_drToken);
}
void
PreProcessor::On_plain( cpp::Token & let_drToken )
{
- if ( let_drToken.TypeId() == Tid_Identifier )
- {
- if (CheckForDefine(let_drToken))
- return;
- }
+ if ( let_drToken.TypeId() == Tid_Identifier )
+ {
+ if (CheckForDefine(let_drToken))
+ return;
+ }
- pCppExplorer->Process_Token(let_drToken);
+ pCppExplorer->Process_Token(let_drToken);
}
void
PreProcessor::On_expect_macro_bracket_left( cpp::Token & let_drToken )
{
- if ( let_drToken.TypeId() == Tid_Bracket_Left )
- {
- aCurParamText.seekp(0);
- eState = expect_macro_param;
- }
- else
- {
- pCppExplorer->Process_Token(*dpCurMacroName);
- dpCurMacroName = 0;
- pCppExplorer->Process_Token(let_drToken);
- eState = plain;
- }
+ if ( let_drToken.TypeId() == Tid_Bracket_Left )
+ {
+ aCurParamText.seekp(0);
+ eState = expect_macro_param;
+ }
+ else
+ {
+ pCppExplorer->Process_Token(*dpCurMacroName);
+ dpCurMacroName = 0;
+ pCppExplorer->Process_Token(let_drToken);
+ eState = plain;
+ }
}
void
PreProcessor::On_expect_macro_param( cpp::Token & let_drToken )
{
- if ( let_drToken.TypeId() == Tid_Bracket_Left )
- nBracketInParameterCounter++;
- else if ( let_drToken.TypeId() == Tid_Bracket_Right )
- {
- if ( nBracketInParameterCounter > 0 )
- nBracketInParameterCounter--;
- else
- {
- if ( NOT csv::no_str(aCurParamText.c_str()) )
- {
- aCurMacroParams.push_back( String(aCurParamText.c_str()) );
- }
- csv_assert( aCurMacroParams.size() == pCurMacro->ParamCount() );
-
- InterpretMacro();
- eState = plain;
- return;
- }
- }
- else if ( let_drToken.TypeId() == Tid_Comma AND nBracketInParameterCounter
== 0 )
- {
- aCurMacroParams.push_back( String (aCurParamText.c_str()) );
- aCurParamText.seekp(0);
- return;
- }
-
- // KORR_FUTURE:
- // If in future whitespace is parsed also, that should match exactly and
the
- // safety spaces, " ", here should be removed.
- aCurParamText << let_drToken.Text() << " ";
+ if ( let_drToken.TypeId() == Tid_Bracket_Left )
+ nBracketInParameterCounter++;
+ else if ( let_drToken.TypeId() == Tid_Bracket_Right )
+ {
+ if ( nBracketInParameterCounter > 0 )
+ nBracketInParameterCounter--;
+ else
+ {
+ if ( NOT csv::no_str(aCurParamText.c_str()) )
+ {
+ aCurMacroParams.push_back(
String(aCurParamText.c_str()) );
+ }
+ csv_assert( aCurMacroParams.size() ==
pCurMacro->ParamCount() );
+
+ InterpretMacro();
+ eState = plain;
+ return;
+ }
+ }
+ else if ( let_drToken.TypeId() == Tid_Comma AND
nBracketInParameterCounter == 0 )
+ {
+ aCurMacroParams.push_back( String (aCurParamText.c_str()) );
+ aCurParamText.seekp(0);
+ return;
+ }
+
+ // KORR_FUTURE:
+ // If in future whitespace is parsed also, that should match exactly
and the
+ // safety spaces, " ", here should be removed.
+ aCurParamText << let_drToken.Text() << " ";
}
bool
PreProcessor::CheckForDefine( cpp::Token & let_drToken )
{
- String sTokenText(let_drToken.Text());
+ String sTokenText(let_drToken.Text());
pCurMacro = csv::value_from_map( *pCurValidDefines, sTokenText );
- if (pCurMacro == 0 )
- return false;
- for ( StringVector::const_iterator it = aBlockedMacroNames.begin();
- it != aBlockedMacroNames.end();
- ++it )
- {
- if ( strcmp( (*it).c_str(), let_drToken.Text() ) == 0 )
- return false;
- }
-
- if ( pCurMacro->DefineType() == DefineDescription::type_define )
- {
- delete &let_drToken;
-
- aCurParamText.seekp(0);
- pCurMacro->GetDefineText(aCurParamText);
-
- if ( aCurParamText.tellp() > 1 )
- pSourceText->InsertTextAtCurPos(aCurParamText.c_str());
- }
- else // ( pCurMacro->DefineType() == DefineDescription::type_macro )
- {
- dpCurMacroName = &let_drToken;
- eState = expect_macro_bracket_left;
- csv::erase_container( aCurMacroParams );
- aCurParamText.seekp(0);
- nBracketInParameterCounter = 0;
- } // endif
-
- return true;
+ if (pCurMacro == 0 )
+ return false;
+ for ( StringVector::const_iterator it = aBlockedMacroNames.begin();
+ it != aBlockedMacroNames.end();
+ ++it )
+ {
+ if ( strcmp( (*it).c_str(), let_drToken.Text() ) == 0 )
+ return false;
+ }
+
+ if ( pCurMacro->DefineType() == DefineDescription::type_define )
+ {
+ delete &let_drToken;
+
+ aCurParamText.seekp(0);
+ pCurMacro->GetDefineText(aCurParamText);
+
+ if ( aCurParamText.tellp() > 1 )
+ pSourceText->InsertTextAtCurPos(aCurParamText.c_str());
+ }
+ else // ( pCurMacro->DefineType() == DefineDescription::type_macro )
+ {
+ dpCurMacroName = &let_drToken;
+ eState = expect_macro_bracket_left;
+ csv::erase_container( aCurMacroParams );
+ aCurParamText.seekp(0);
+ nBracketInParameterCounter = 0;
+ } // endif
+
+ return true;
}
void
PreProcessor::UnblockMacro( const char * i_sMacroName )
{
- for ( StringVector::iterator it = aBlockedMacroNames.begin();
- it != aBlockedMacroNames.end();
- ++it )
- {
- if ( strcmp( (*it), i_sMacroName ) == 0 )
- {
- aBlockedMacroNames.erase(it);
- break;
- }
- } /// end for
+ for ( StringVector::iterator it = aBlockedMacroNames.begin();
+ it != aBlockedMacroNames.end();
+ ++it )
+ {
+ if ( strcmp( (*it), i_sMacroName ) == 0 )
+ {
+ aBlockedMacroNames.erase(it);
+ break;
+ }
+ } // end for
}
void
PreProcessor::InterpretMacro()
{
- aCurParamText.seekp(0);
- pCurMacro->GetMacroText(aCurParamText, aCurMacroParams);
-
- if ( NOT csv::no_str(aCurParamText.c_str()) )
- {
- aCurParamText.seekp(-1, csv::cur);
- aCurParamText << " #unblock-" << dpCurMacroName->Text() << " ";
-
- pSourceText->InsertTextAtCurPos(aCurParamText.c_str());
- String sCurMacroName(dpCurMacroName->Text());
- aBlockedMacroNames.insert( aBlockedMacroNames.begin(), sCurMacroName );
- }
-
- delete dpCurMacroName;
- dpCurMacroName = 0;
- pCurMacro = 0;
- csv::erase_container(aCurMacroParams);
- aCurParamText.seekp(0);
+ aCurParamText.seekp(0);
+ pCurMacro->GetMacroText(aCurParamText, aCurMacroParams);
+
+ if ( NOT csv::no_str(aCurParamText.c_str()) )
+ {
+ aCurParamText.seekp(-1, csv::cur);
+ aCurParamText << " #unblock-" << dpCurMacroName->Text() << " ";
+
+ pSourceText->InsertTextAtCurPos(aCurParamText.c_str());
+ String sCurMacroName(dpCurMacroName->Text());
+ aBlockedMacroNames.insert( aBlockedMacroNames.begin(),
sCurMacroName );
+ }
+
+ delete dpCurMacroName;
+ dpCurMacroName = 0;
+ pCurMacro = 0;
+ csv::erase_container(aCurMacroParams);
+ aCurParamText.seekp(0);
}
-} // end namespace cpp
+} // end namespace cpp
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/canvas/source/cairo/cairo_canvasfont.cxx
b/main/canvas/source/cairo/cairo_canvasfont.cxx
index d0723ca42e..513c33dd2d 100644
--- a/main/canvas/source/cairo/cairo_canvasfont.cxx
+++ b/main/canvas/source/cairo/cairo_canvasfont.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,20 +7,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_canvas.hxx"
@@ -41,154 +39,156 @@ using namespace ::com::sun::star;
namespace cairocanvas
{
- namespace
- {
- // Little helper to encapsulate locking into policy class
- class LocalGuard
- {
- public:
- LocalGuard() :
- aGuard( Application::GetSolarMutex() )
- {
- }
-
- /// To be compatible with CanvasBase mutex concept
- LocalGuard( const ::osl::Mutex& ) :
- aGuard( Application::GetSolarMutex() )
- {
- }
-
- private:
- ::vos::OGuard aGuard;
- };
- }
-
- CanvasFont::CanvasFont( const rendering::FontRequest&
rFontRequest,
- const uno::Sequence< beans::PropertyValue >&
/*rExtraFontProperties*/,
- const geometry::Matrix2D&
rFontMatrix,
- const SurfaceProviderRef&
rDevice ) :
- CanvasFont_Base( m_aMutex ),
- maFont( Font( rFontRequest.FontDescription.FamilyName,
- rFontRequest.FontDescription.StyleName,
- Size( 0, ::basegfx::fround(rFontRequest.CellSize) ) ) ),
- maFontRequest( rFontRequest ),
- mpRefDevice( rDevice )
- {
- maFont->SetAlign( ALIGN_BASELINE );
- maFont->SetCharSet(
(rFontRequest.FontDescription.IsSymbolFont==com::sun::star::util::TriState_YES)
? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
- maFont->SetVertical(
(rFontRequest.FontDescription.IsVertical==com::sun::star::util::TriState_YES) ?
sal_True : sal_False );
-
- // TODO(F2): improve panose->vclenum conversion
- maFont->SetWeight(
static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
- maFont->SetItalic(
(rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE :
ITALIC_NORMAL );
- maFont->SetPitch(
- rFontRequest.FontDescription.FontDescription.Proportion ==
rendering::PanoseProportion::MONO_SPACED
- ? PITCH_FIXED : PITCH_VARIABLE);
-
-
maFont->SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale));
-
- // adjust to stretched/shrunk font
- if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) )
- {
- OutputDevice* pOutDev( mpRefDevice->getOutputDevice() );
-
- if( pOutDev )
- {
- const bool bOldMapState( pOutDev->IsMapModeEnabled() );
- pOutDev->EnableMapMode(sal_False);
-
- const Size aSize = pOutDev->GetFontMetric( *maFont ).GetSize();
-
- const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
- double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
-
- if( !::basegfx::fTools::equalZero( fDividend) )
- fStretch /= fDividend;
-
- const long nNewWidth = ::basegfx::fround( aSize.Width() *
fStretch );
-
- maFont->SetWidth( nNewWidth );
-
- pOutDev->EnableMapMode(bOldMapState);
- }
- }
- }
-
- void SAL_CALL CanvasFont::disposing()
- {
- LocalGuard aGuard;
-
- mpRefDevice.clear();
- }
-
- uno::Reference< rendering::XTextLayout > SAL_CALL
CanvasFont::createTextLayout( const rendering::StringContext& aText, sal_Int8
nDirection, sal_Int64 nRandomSeed ) throw (uno::RuntimeException)
- {
- LocalGuard aGuard;
-
- if( !mpRefDevice.is() )
- return uno::Reference< rendering::XTextLayout >(); // we're
disposed
-
- return new TextLayout( aText,
- nDirection,
- nRandomSeed,
- Reference( this ),
+ namespace
+ {
+ // Little helper to encapsulate locking into policy class
+ class LocalGuard
+ {
+ public:
+ LocalGuard() :
+ aGuard( Application::GetSolarMutex() )
+ {
+ }
+
+ // To be compatible with CanvasBase mutex concept
+ LocalGuard( const ::osl::Mutex& ) :
+ aGuard( Application::GetSolarMutex() )
+ {
+ }
+
+ private:
+ ::vos::OGuard aGuard;
+ };
+ }
+
+ CanvasFont::CanvasFont( const rendering::FontRequest&
rFontRequest,
+ const uno::Sequence<
beans::PropertyValue >& /*rExtraFontProperties*/,
+ const
geometry::Matrix2D& rFontMatrix,
+ const
SurfaceProviderRef& rDevice ) :
+ CanvasFont_Base( m_aMutex ),
+ maFont( Font( rFontRequest.FontDescription.FamilyName,
+
rFontRequest.FontDescription.StyleName,
+ Size( 0,
::basegfx::fround(rFontRequest.CellSize) ) ) ),
+ maFontRequest( rFontRequest ),
+ mpRefDevice( rDevice )
+ {
+ maFont->SetAlign( ALIGN_BASELINE );
+ maFont->SetCharSet(
(rFontRequest.FontDescription.IsSymbolFont==com::sun::star::util::TriState_YES)
? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
+ maFont->SetVertical(
(rFontRequest.FontDescription.IsVertical==com::sun::star::util::TriState_YES) ?
sal_True : sal_False );
+
+ // TODO(F2): improve panose->vclenum conversion
+ maFont->SetWeight(
static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
+ maFont->SetItalic(
(rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE :
ITALIC_NORMAL );
+ maFont->SetPitch(
+
rFontRequest.FontDescription.FontDescription.Proportion ==
rendering::PanoseProportion::MONO_SPACED
+ ? PITCH_FIXED : PITCH_VARIABLE);
+
+
maFont->SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale));
+
+ // adjust to stretched/shrunk font
+ if( !::rtl::math::approxEqual( rFontMatrix.m00,
rFontMatrix.m11) )
+ {
+ OutputDevice* pOutDev( mpRefDevice->getOutputDevice() );
+
+ if( pOutDev )
+ {
+ const bool bOldMapState(
pOutDev->IsMapModeEnabled() );
+ pOutDev->EnableMapMode(sal_False);
+
+ const Size aSize = pOutDev->GetFontMetric(
*maFont ).GetSize();
+
+ const double fDividend( rFontMatrix.m10 +
rFontMatrix.m11 );
+ double fStretch = (rFontMatrix.m00 +
rFontMatrix.m01);
+
+ if( !::basegfx::fTools::equalZero( fDividend) )
+ fStretch /= fDividend;
+
+ const long nNewWidth = ::basegfx::fround(
aSize.Width() * fStretch );
+
+ maFont->SetWidth( nNewWidth );
+
+ pOutDev->EnableMapMode(bOldMapState);
+ }
+ }
+ }
+
+ void SAL_CALL CanvasFont::disposing()
+ {
+ LocalGuard aGuard;
+
+ mpRefDevice.clear();
+ }
+
+ uno::Reference< rendering::XTextLayout > SAL_CALL
CanvasFont::createTextLayout( const rendering::StringContext& aText, sal_Int8
nDirection, sal_Int64 nRandomSeed ) throw (uno::RuntimeException)
+ {
+ LocalGuard aGuard;
+
+ if( !mpRefDevice.is() )
+ return uno::Reference< rendering::XTextLayout >(); //
we're disposed
+
+ return new TextLayout( aText,
+ nDirection,
+ nRandomSeed,
+ Reference( this ),
mpRefDevice );
- }
+ }
- rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( ) throw
(uno::RuntimeException)
- {
- LocalGuard aGuard;
+ rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( ) throw
(uno::RuntimeException)
+ {
+ LocalGuard aGuard;
- return maFontRequest;
- }
+ return maFontRequest;
+ }
- rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics( ) throw
(uno::RuntimeException)
- {
- LocalGuard aGuard;
+ rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics( ) throw
(uno::RuntimeException)
+ {
+ LocalGuard aGuard;
- // TODO(F1)
- return rendering::FontMetrics();
- }
+ // TODO(F1)
+ return rendering::FontMetrics();
+ }
- uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( ) throw
(uno::RuntimeException)
- {
- LocalGuard aGuard;
+ uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( )
throw (uno::RuntimeException)
+ {
+ LocalGuard aGuard;
- // TODO(F1)
- return uno::Sequence< double >();
- }
+ // TODO(F1)
+ return uno::Sequence< double >();
+ }
- uno::Sequence< beans::PropertyValue > SAL_CALL
CanvasFont::getExtraFontProperties( ) throw (uno::RuntimeException)
- {
- LocalGuard aGuard;
+ uno::Sequence< beans::PropertyValue > SAL_CALL
CanvasFont::getExtraFontProperties( ) throw (uno::RuntimeException)
+ {
+ LocalGuard aGuard;
- // TODO(F1)
- return uno::Sequence< beans::PropertyValue >();
- }
+ // TODO(F1)
+ return uno::Sequence< beans::PropertyValue >();
+ }
#define IMPLEMENTATION_NAME "CairoCanvas::CanvasFont"
#define SERVICE_NAME "com.sun.star.rendering.CanvasFont"
- ::rtl::OUString SAL_CALL CanvasFont::getImplementationName() throw(
uno::RuntimeException )
- {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
IMPLEMENTATION_NAME ) );
- }
+ ::rtl::OUString SAL_CALL CanvasFont::getImplementationName() throw(
uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
IMPLEMENTATION_NAME ) );
+ }
- sal_Bool SAL_CALL CanvasFont::supportsService( const ::rtl::OUString&
ServiceName ) throw( uno::RuntimeException )
- {
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM (
SERVICE_NAME ) );
- }
+ sal_Bool SAL_CALL CanvasFont::supportsService( const ::rtl::OUString&
ServiceName ) throw( uno::RuntimeException )
+ {
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM (
SERVICE_NAME ) );
+ }
- uno::Sequence< ::rtl::OUString > SAL_CALL
CanvasFont::getSupportedServiceNames() throw( uno::RuntimeException )
- {
- uno::Sequence< ::rtl::OUString > aRet(1);
- aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME
) );
+ uno::Sequence< ::rtl::OUString > SAL_CALL
CanvasFont::getSupportedServiceNames() throw( uno::RuntimeException )
+ {
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM (
SERVICE_NAME ) );
- return aRet;
- }
+ return aRet;
+ }
- ::Font CanvasFont::getVCLFont() const
- {
- return *maFont;
- }
+ ::Font CanvasFont::getVCLFont() const
+ {
+ return *maFont;
+ }
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/chart2/source/controller/main/CommandDispatch.cxx
b/main/chart2/source/controller/main/CommandDispatch.cxx
index fe81bcdc21..1419d4e5d1 100644
--- a/main/chart2/source/controller/main/CommandDispatch.cxx
+++ b/main/chart2/source/controller/main/CommandDispatch.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,20 +7,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
@@ -40,31 +38,31 @@ using ::rtl::OUString;
namespace
{
template< class Map >
- struct lcl_DisposeAndClearAndDeleteMapElement :
- public ::std::unary_function< typename Map::value_type, void >
- {
- lcl_DisposeAndClearAndDeleteMapElement( const Reference<
uno::XInterface > & xEventSource ) :
- m_aEvent( xEventSource )
- {}
- void operator() ( typename Map::value_type & rElement )
- {
- if( rElement.second )
- {
- rElement.second->disposeAndClear( m_aEvent );
- delete rElement.second;
- }
- }
- private:
- lang::EventObject m_aEvent;
- };
+ struct lcl_DisposeAndClearAndDeleteMapElement :
+ public ::std::unary_function< typename Map::value_type, void >
+ {
+ lcl_DisposeAndClearAndDeleteMapElement( const Reference<
uno::XInterface > & xEventSource ) :
+ m_aEvent( xEventSource )
+ {}
+ void operator() ( typename Map::value_type & rElement )
+ {
+ if( rElement.second )
+ {
+ rElement.second->disposeAndClear( m_aEvent );
+ delete rElement.second;
+ }
+ }
+ private:
+ lang::EventObject m_aEvent;
+ };
template< class Map >
- void lcl_DisposeAndClearAndDeleteAllMapElements(
- Map & rMap,
- const Reference< uno::XInterface > & xEventSource )
+ void lcl_DisposeAndClearAndDeleteAllMapElements(
+ Map & rMap,
+ const Reference< uno::XInterface > & xEventSource )
{
- ::std::for_each( rMap.begin(), rMap.end(),
- lcl_DisposeAndClearAndDeleteMapElement< Map >(
xEventSource ));
+ ::std::for_each( rMap.begin(), rMap.end(),
+
lcl_DisposeAndClearAndDeleteMapElement< Map >( xEventSource ));
}
} // anonymous namespace
@@ -73,9 +71,9 @@ namespace chart
{
CommandDispatch::CommandDispatch(
- const Reference< uno::XComponentContext > & xContext ) :
- impl::CommandDispatch_Base( m_aMutex ),
- m_xContext( xContext )
+ const Reference< uno::XComponentContext > & xContext ) :
+ impl::CommandDispatch_Base( m_aMutex ),
+ m_xContext( xContext )
{
}
@@ -86,122 +84,122 @@ void CommandDispatch::initialize()
{}
// ____ WeakComponentImplHelperBase ____
-/// is called when this is disposed
+// is called when this is disposed
void SAL_CALL CommandDispatch::disposing()
{
- lcl_DisposeAndClearAndDeleteAllMapElements( m_aListeners, static_cast<
cppu::OWeakObject* >( this ));
- m_aListeners.clear();
+ lcl_DisposeAndClearAndDeleteAllMapElements( m_aListeners, static_cast<
cppu::OWeakObject* >( this ));
+ m_aListeners.clear();
}
// ____ XDispatch ____
void SAL_CALL CommandDispatch::dispatch( const util::URL& /* URL */, const
Sequence< beans::PropertyValue >& /* Arguments */ )
- throw (uno::RuntimeException)
+ throw (uno::RuntimeException)
{}
void SAL_CALL CommandDispatch::addStatusListener( const Reference<
frame::XStatusListener >& Control, const util::URL& URL )
- throw (uno::RuntimeException)
+ throw (uno::RuntimeException)
{
- tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
- if( aIt == m_aListeners.end())
- {
- aIt = m_aListeners.insert(
- m_aListeners.begin(),
- tListenerMap::value_type( URL.Complete, new
::cppu::OInterfaceContainerHelper( m_aMutex )));
- }
- OSL_ASSERT( aIt != m_aListeners.end());
-
- aIt->second->addInterface( Control );
- fireStatusEvent( URL.Complete, Control );
+ tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
+ if( aIt == m_aListeners.end())
+ {
+ aIt = m_aListeners.insert(
+ m_aListeners.begin(),
+ tListenerMap::value_type( URL.Complete, new
::cppu::OInterfaceContainerHelper( m_aMutex )));
+ }
+ OSL_ASSERT( aIt != m_aListeners.end());
+
+ aIt->second->addInterface( Control );
+ fireStatusEvent( URL.Complete, Control );
}
void SAL_CALL CommandDispatch::removeStatusListener( const Reference<
frame::XStatusListener >& Control, const util::URL& URL )
- throw (uno::RuntimeException)
+ throw (uno::RuntimeException)
{
- tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
- if( aIt != m_aListeners.end())
- (*aIt).second->removeInterface( Control );
+ tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
+ if( aIt != m_aListeners.end())
+ (*aIt).second->removeInterface( Control );
}
// ____ XModifyListener ____
void SAL_CALL CommandDispatch::modified( const lang::EventObject& /* aEvent */
)
- throw (uno::RuntimeException)
+ throw (uno::RuntimeException)
{
- fireAllStatusEvents( 0 );
+ fireAllStatusEvents( 0 );
}
// ____ XEventListener (base of XModifyListener) ____
void SAL_CALL CommandDispatch::disposing( const lang::EventObject& /* Source
*/ )
- throw (uno::RuntimeException)
+ throw (uno::RuntimeException)
{}
void CommandDispatch::fireAllStatusEvents(
- const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XStatusListener > & xSingleListener )
+ const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XStatusListener > & xSingleListener )
{
- fireStatusEvent( OUString(), xSingleListener );
+ fireStatusEvent( OUString(), xSingleListener );
}
void CommandDispatch::fireStatusEventForURL(
- const OUString & rURL,
- const uno::Any & rState,
- bool bEnabled,
- const Reference< frame::XStatusListener > & xSingleListener, /* = 0 */
- const OUString & rFeatureDescriptor /* = OUString() */ )
+ const OUString & rURL,
+ const uno::Any & rState,
+ bool bEnabled,
+ const Reference< frame::XStatusListener > & xSingleListener, /* = 0 */
+ const OUString & rFeatureDescriptor /* = OUString() */ )
{
- // prepare event to send
- util::URL aURL;
- aURL.Complete = rURL;
- if( !m_xURLTransformer.is())
- {
- m_xURLTransformer.set(
- m_xContext->getServiceManager()->createInstanceWithContext(
- C2U( "com.sun.star.util.URLTransformer" ),
- m_xContext ),
- uno::UNO_QUERY );
- }
- if( m_xURLTransformer.is())
- m_xURLTransformer->parseStrict( aURL );
-
- frame::FeatureStateEvent aEventToSend(
- static_cast< cppu::OWeakObject* >( this ), // Source
- aURL, // FeatureURL
- rFeatureDescriptor, // FeatureDescriptor
- bEnabled, // IsEnabled
- false, // Requery
- rState // State
- );
-
- // send event either to single listener or all registered ones
- if( xSingleListener.is())
- xSingleListener->statusChanged( aEventToSend );
- else
- {
- tListenerMap::iterator aIt( m_aListeners.find( aURL.Complete ));
- if( aIt != m_aListeners.end())
- {
-// ::cppu::OInterfaceContainerHelper * pCntHlp =
rBHelper.getContainer(
-// ::getCppuType( reinterpret_cast< Reference<
frame::XStatusListener > * >(0)));
- if( aIt->second )
- {
- ::cppu::OInterfaceIteratorHelper aIntfIt( *((*aIt).second) );
-
- while( aIntfIt.hasMoreElements())
- {
- Reference< frame::XStatusListener > xListener(
aIntfIt.next(), uno::UNO_QUERY );
- try
- {
- if( xListener.is())
- xListener->statusChanged( aEventToSend );
- }
- catch( const uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- }
- }
- }
- }
- }
+ // prepare event to send
+ util::URL aURL;
+ aURL.Complete = rURL;
+ if( !m_xURLTransformer.is())
+ {
+ m_xURLTransformer.set(
+
m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.util.URLTransformer" ),
+ m_xContext ),
+ uno::UNO_QUERY );
+ }
+ if( m_xURLTransformer.is())
+ m_xURLTransformer->parseStrict( aURL );
+
+ frame::FeatureStateEvent aEventToSend(
+ static_cast< cppu::OWeakObject* >( this ), // Source
+ aURL, // FeatureURL
+ rFeatureDescriptor, // FeatureDescriptor
+ bEnabled, // IsEnabled
+ false, // Requery
+ rState // State
+ );
+
+ // send event either to single listener or all registered ones
+ if( xSingleListener.is())
+ xSingleListener->statusChanged( aEventToSend );
+ else
+ {
+ tListenerMap::iterator aIt( m_aListeners.find( aURL.Complete ));
+ if( aIt != m_aListeners.end())
+ {
+// ::cppu::OInterfaceContainerHelper * pCntHlp =
rBHelper.getContainer(
+// ::getCppuType( reinterpret_cast< Reference<
frame::XStatusListener > * >(0)));
+ if( aIt->second )
+ {
+ ::cppu::OInterfaceIteratorHelper aIntfIt(
*((*aIt).second) );
+
+ while( aIntfIt.hasMoreElements())
+ {
+ Reference< frame::XStatusListener >
xListener( aIntfIt.next(), uno::UNO_QUERY );
+ try
+ {
+ if( xListener.is())
+
xListener->statusChanged( aEventToSend );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ }
}
-
-
} // namespace chart
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/chart2/source/controller/main/UndoCommandDispatch.cxx
b/main/chart2/source/controller/main/UndoCommandDispatch.cxx
index 48322cb203..f18e070b99 100644
--- a/main/chart2/source/controller/main/UndoCommandDispatch.cxx
+++ b/main/chart2/source/controller/main/UndoCommandDispatch.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,20 +7,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
@@ -49,13 +47,13 @@ namespace chart
{
UndoCommandDispatch::UndoCommandDispatch(
- const Reference< uno::XComponentContext > & xContext,
- const Reference< frame::XModel > & xModel ) :
- CommandDispatch( xContext ),
- m_xModel( xModel )
+ const Reference< uno::XComponentContext > & xContext,
+ const Reference< frame::XModel > & xModel ) :
+ CommandDispatch( xContext ),
+ m_xModel( xModel )
{
- uno::Reference< document::XUndoManagerSupplier > xSuppUndo( m_xModel,
uno::UNO_QUERY_THROW );
- m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XUndoManagerSupplier > xSuppUndo( m_xModel,
uno::UNO_QUERY_THROW );
+ m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
}
UndoCommandDispatch::~UndoCommandDispatch()
@@ -63,90 +61,92 @@ UndoCommandDispatch::~UndoCommandDispatch()
void UndoCommandDispatch::initialize()
{
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager,
uno::UNO_QUERY );
- ENSURE_OR_RETURN_VOID( xBroadcaster.is(),
"UndoCommandDispatch::initialize: missing modification broadcaster interface!"
);
- xBroadcaster->addModifyListener( this );
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager,
uno::UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xBroadcaster.is(),
"UndoCommandDispatch::initialize: missing modification broadcaster interface!"
);
+ xBroadcaster->addModifyListener( this );
}
void UndoCommandDispatch::fireStatusEvent(
- const OUString & rURL,
- const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
+ const OUString & rURL,
+ const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
{
- if( m_xUndoManager.is() )
- {
- const bool bFireAll = rURL.isEmpty();
- uno::Any aUndoState, aRedoState;
- if( m_xUndoManager->isUndoPossible())
- {
- // using assignment for broken gcc 3.3
- OUString aUndo = OUString( String( SvtResId( STR_UNDO )));
- aUndoState <<= ( aUndo +
m_xUndoManager->getCurrentUndoActionTitle());
- }
- if( m_xUndoManager->isRedoPossible())
- {
- // using assignment for broken gcc 3.3
- OUString aRedo = OUString( String( SvtResId( STR_REDO )));
- aRedoState <<= ( aRedo +
m_xUndoManager->getCurrentRedoActionTitle());
- }
-
- if( bFireAll || rURL.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM(".uno:Undo")))
- fireStatusEventForURL( C2U(".uno:Undo"), aUndoState,
m_xUndoManager->isUndoPossible(), xSingleListener );
- if( bFireAll || rURL.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM(".uno:Redo")))
- fireStatusEventForURL( C2U(".uno:Redo"), aRedoState,
m_xUndoManager->isRedoPossible(), xSingleListener );
- }
+ if( m_xUndoManager.is() )
+ {
+ const bool bFireAll = rURL.isEmpty();
+ uno::Any aUndoState, aRedoState;
+ if( m_xUndoManager->isUndoPossible())
+ {
+ // using assignment for broken gcc 3.3
+ OUString aUndo = OUString( String( SvtResId( STR_UNDO
)));
+ aUndoState <<= ( aUndo +
m_xUndoManager->getCurrentUndoActionTitle());
+ }
+ if( m_xUndoManager->isRedoPossible())
+ {
+ // using assignment for broken gcc 3.3
+ OUString aRedo = OUString( String( SvtResId( STR_REDO
)));
+ aRedoState <<= ( aRedo +
m_xUndoManager->getCurrentRedoActionTitle());
+ }
+
+ if( bFireAll || rURL.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM(".uno:Undo")))
+ fireStatusEventForURL( C2U(".uno:Undo"), aUndoState,
m_xUndoManager->isUndoPossible(), xSingleListener );
+ if( bFireAll || rURL.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM(".uno:Redo")))
+ fireStatusEventForURL( C2U(".uno:Redo"), aRedoState,
m_xUndoManager->isRedoPossible(), xSingleListener );
+ }
}
// ____ XDispatch ____
void SAL_CALL UndoCommandDispatch::dispatch(
- const util::URL& URL,
- const Sequence< beans::PropertyValue >& /* Arguments */ )
- throw (uno::RuntimeException)
+ const util::URL& URL,
+ const Sequence< beans::PropertyValue >& /* Arguments */ )
+ throw (uno::RuntimeException)
{
- if( m_xUndoManager.is() )
- {
- // why is it necessary to lock the solar mutex here?
- // /--
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
- try
- {
- if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" )))
- m_xUndoManager->undo();
- else
- m_xUndoManager->redo();
- }
- catch( const document::UndoFailedException& )
- {
- // silently ignore
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- // \--
- }
+ if( m_xUndoManager.is() )
+ {
+ // why is it necessary to lock the solar mutex here?
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ try
+ {
+ if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
"Undo" )))
+ m_xUndoManager->undo();
+ else
+ m_xUndoManager->redo();
+ }
+ catch( const document::UndoFailedException& )
+ {
+ // silently ignore
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ // \--
+ }
}
// ____ WeakComponentImplHelperBase ____
-/// is called when this is disposed
+// is called when this is disposed
void SAL_CALL UndoCommandDispatch::disposing()
{
- Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager,
uno::UNO_QUERY );
- OSL_ENSURE( xBroadcaster.is(), "UndoCommandDispatch::initialize: missing
modification broadcaster interface!" );
- if( xBroadcaster.is() )
- {
- xBroadcaster->removeModifyListener( this );
- }
-
- m_xUndoManager.clear();
- m_xModel.clear();
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager,
uno::UNO_QUERY );
+ OSL_ENSURE( xBroadcaster.is(), "UndoCommandDispatch::initialize:
missing modification broadcaster interface!" );
+ if( xBroadcaster.is() )
+ {
+ xBroadcaster->removeModifyListener( this );
+ }
+
+ m_xUndoManager.clear();
+ m_xModel.clear();
}
// ____ XEventListener (base of XModifyListener) ____
void SAL_CALL UndoCommandDispatch::disposing( const lang::EventObject& /*
Source */ )
- throw (uno::RuntimeException)
+ throw (uno::RuntimeException)
{
- m_xUndoManager.clear();
- m_xModel.clear();
+ m_xUndoManager.clear();
+ m_xModel.clear();
}
} // namespace chart
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/slideshow/source/engine/screenupdater.cxx
b/main/slideshow/source/engine/screenupdater.cxx
index c470e9a633..b5a1b57f4e 100644
--- a/main/slideshow/source/engine/screenupdater.cxx
+++ b/main/slideshow/source/engine/screenupdater.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,19 +7,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
#include "precompiled_slideshow.hxx"
#include "screenupdater.hxx"
@@ -30,199 +29,199 @@
#include <algorithm>
namespace {
- class UpdateLock : public ::slideshow::internal::ScreenUpdater::UpdateLock
- {
- public:
- UpdateLock (::slideshow::internal::ScreenUpdater& rUpdater, const bool
bStartLocked);
- virtual ~UpdateLock (void);
- virtual void Activate (void);
- private:
- ::slideshow::internal::ScreenUpdater& mrUpdater;
- bool mbIsActivated;
- };
+ class UpdateLock : public
::slideshow::internal::ScreenUpdater::UpdateLock
+ {
+ public:
+ UpdateLock (::slideshow::internal::ScreenUpdater& rUpdater,
const bool bStartLocked);
+ virtual ~UpdateLock (void);
+ virtual void Activate (void);
+ private:
+ ::slideshow::internal::ScreenUpdater& mrUpdater;
+ bool mbIsActivated;
+ };
}
namespace slideshow
{
namespace internal
{
- typedef std::vector<
- std::pair<UnoViewSharedPtr,bool> > UpdateRequestVector;
-
- struct ScreenUpdater::ImplScreenUpdater
- {
- /** List of registered ViewUpdaters, to consult for necessary
- updates
- */
- ThreadUnsafeListenerContainer<
- ViewUpdateSharedPtr,
- std::vector<ViewUpdateSharedPtr> > maUpdaters;
-
- /// Views that have been notified for update
- UpdateRequestVector maViewUpdateRequests;
-
- /// List of View. Used to issue screen updates on.
- UnoViewContainer const& mrViewContainer;
-
- /// True, if a notifyUpdate() for all views has been issued.
- bool mbUpdateAllRequest;
-
- /// True, if at least one notifyUpdate() call had bViewClobbered set
- bool mbViewClobbered;
-
- /// The screen is updated only when mnLockCount==0
- sal_Int32 mnLockCount;
-
- explicit ImplScreenUpdater( UnoViewContainer const& rViewContainer ) :
- maUpdaters(),
- maViewUpdateRequests(),
- mrViewContainer(rViewContainer),
- mbUpdateAllRequest(false),
- mbViewClobbered(false),
- mnLockCount(0)
- {}
- };
-
- ScreenUpdater::ScreenUpdater( UnoViewContainer const& rViewContainer ) :
- mpImpl(new ImplScreenUpdater(rViewContainer) )
- {
- }
-
- ScreenUpdater::~ScreenUpdater()
- {
- // outline because of pimpl
- }
-
- void ScreenUpdater::notifyUpdate()
- {
- mpImpl->mbUpdateAllRequest = true;
- }
-
- void ScreenUpdater::notifyUpdate( const UnoViewSharedPtr& rView,
- bool bViewClobbered )
- {
- mpImpl->maViewUpdateRequests.push_back(
- std::make_pair(rView, bViewClobbered) );
-
- if( bViewClobbered )
- mpImpl->mbViewClobbered = true;
- }
-
- void ScreenUpdater::commitUpdates()
- {
- if (mpImpl->mnLockCount > 0)
- return;
-
- // cases:
- //
- // (a) no update necessary at all
- //
- // (b) no ViewUpdate-generated update
- // I. update all views requested -> for_each( mrViewContainer )
- // II. update some views requested -> for_each(
maViewUpdateRequests )
- //
- // (c) ViewUpdate-triggered update - update all views
- //
-
- // any ViewUpdate-triggered updates?
- const bool bViewUpdatesNeeded(
- mpImpl->maUpdaters.apply(
- boost::mem_fn(&ViewUpdate::needsUpdate)) );
-
- if( bViewUpdatesNeeded )
- {
- mpImpl->maUpdaters.applyAll(
- boost::mem_fn((bool (ViewUpdate::*)())&ViewUpdate::update) );
- }
-
- if( bViewUpdatesNeeded ||
- mpImpl->mbUpdateAllRequest )
- {
- // unconditionally update all views
- std::for_each( mpImpl->mrViewContainer.begin(),
- mpImpl->mrViewContainer.end(),
- mpImpl->mbViewClobbered ?
- boost::mem_fn(&View::paintScreen) :
- boost::mem_fn(&View::updateScreen) );
- }
- else if( !mpImpl->maViewUpdateRequests.empty() )
- {
- // update notified views only
- UpdateRequestVector::const_iterator aIter(
- mpImpl->maViewUpdateRequests.begin() );
- const UpdateRequestVector::const_iterator aEnd(
- mpImpl->maViewUpdateRequests.end() );
- while( aIter != aEnd )
- {
- // TODO(P1): this is O(n^2) in the number of views, if
- // lots of views notify updates.
- const UnoViewVector::const_iterator aEndOfViews(
- mpImpl->mrViewContainer.end() );
- UnoViewVector::const_iterator aFoundView;
- if( (aFoundView=std::find(mpImpl->mrViewContainer.begin(),
- aEndOfViews,
- aIter->first)) != aEndOfViews )
- {
- if( aIter->second )
- (*aFoundView)->paintScreen(); // force-paint
- else
- (*aFoundView)->updateScreen(); // update changes only
- }
-
- ++aIter;
- }
- }
-
- // done - clear requests
- mpImpl->mbViewClobbered = false;
- mpImpl->mbUpdateAllRequest = false;
- UpdateRequestVector().swap( mpImpl->maViewUpdateRequests );
- }
-
- void ScreenUpdater::addViewUpdate( ViewUpdateSharedPtr const& rViewUpdate )
- {
- mpImpl->maUpdaters.add( rViewUpdate );
- }
-
- void ScreenUpdater::removeViewUpdate( ViewUpdateSharedPtr const&
rViewUpdate )
- {
- mpImpl->maUpdaters.remove( rViewUpdate );
- }
-
- void ScreenUpdater::requestImmediateUpdate()
- {
- if (mpImpl->mnLockCount > 0)
- return;
-
- // TODO(F2): This will interfere with other updates, since it
- // happens out-of-sync with main animation loop. Might cause
- // artifacts.
- std::for_each( mpImpl->mrViewContainer.begin(),
- mpImpl->mrViewContainer.end(),
- boost::mem_fn(&View::updateScreen) );
- }
-
- void ScreenUpdater::lockUpdates (void)
- {
- ++mpImpl->mnLockCount;
- OSL_ASSERT(mpImpl->mnLockCount>0);
- }
-
- void ScreenUpdater::unlockUpdates (void)
- {
- OSL_ASSERT(mpImpl->mnLockCount>0);
- if (mpImpl->mnLockCount > 0)
- {
- --mpImpl->mnLockCount;
- if (mpImpl->mnLockCount)
- commitUpdates();
- }
- }
-
- ::boost::shared_ptr<ScreenUpdater::UpdateLock> ScreenUpdater::createLock
(const bool bStartLocked)
- {
- return ::boost::shared_ptr<ScreenUpdater::UpdateLock>(new
::UpdateLock(*this, bStartLocked));
- }
+ typedef std::vector<
+ std::pair<UnoViewSharedPtr,bool> > UpdateRequestVector;
+
+ struct ScreenUpdater::ImplScreenUpdater
+ {
+ /** List of registered ViewUpdaters, to consult for necessary
+ updates
+ */
+ ThreadUnsafeListenerContainer<
+ ViewUpdateSharedPtr,
+ std::vector<ViewUpdateSharedPtr> > maUpdaters;
+
+ // Views that have been notified for update
+ UpdateRequestVector maViewUpdateRequests;
+
+ // List of View. Used to issue screen updates on.
+ UnoViewContainer const& mrViewContainer;
+
+ // True, if a notifyUpdate() for all views has been issued.
+ bool mbUpdateAllRequest;
+
+ // True, if at least one notifyUpdate() call had bViewClobbered
set
+ bool mbViewClobbered;
+
+ // The screen is updated only when mnLockCount==0
+ sal_Int32 mnLockCount;
+
+ explicit ImplScreenUpdater( UnoViewContainer const&
rViewContainer ) :
+ maUpdaters(),
+ maViewUpdateRequests(),
+ mrViewContainer(rViewContainer),
+ mbUpdateAllRequest(false),
+ mbViewClobbered(false),
+ mnLockCount(0)
+ {}
+ };
+
+ ScreenUpdater::ScreenUpdater( UnoViewContainer const& rViewContainer ) :
+ mpImpl(new ImplScreenUpdater(rViewContainer) )
+ {
+ }
+
+ ScreenUpdater::~ScreenUpdater()
+ {
+ // outline because of pimpl
+ }
+
+ void ScreenUpdater::notifyUpdate()
+ {
+ mpImpl->mbUpdateAllRequest = true;
+ }
+
+ void ScreenUpdater::notifyUpdate( const UnoViewSharedPtr& rView,
+ bool
bViewClobbered )
+ {
+ mpImpl->maViewUpdateRequests.push_back(
+ std::make_pair(rView, bViewClobbered) );
+
+ if( bViewClobbered )
+ mpImpl->mbViewClobbered = true;
+ }
+
+ void ScreenUpdater::commitUpdates()
+ {
+ if (mpImpl->mnLockCount > 0)
+ return;
+
+ // cases:
+ //
+ // (a) no update necessary at all
+ //
+ // (b) no ViewUpdate-generated update
+ // I. update all views requested -> for_each(
mrViewContainer )
+ // II. update some views requested -> for_each(
maViewUpdateRequests )
+ //
+ // (c) ViewUpdate-triggered update - update all views
+ //
+
+ // any ViewUpdate-triggered updates?
+ const bool bViewUpdatesNeeded(
+ mpImpl->maUpdaters.apply(
+ boost::mem_fn(&ViewUpdate::needsUpdate)) );
+
+ if( bViewUpdatesNeeded )
+ {
+ mpImpl->maUpdaters.applyAll(
+ boost::mem_fn((bool
(ViewUpdate::*)())&ViewUpdate::update) );
+ }
+
+ if( bViewUpdatesNeeded ||
+ mpImpl->mbUpdateAllRequest )
+ {
+ // unconditionally update all views
+ std::for_each( mpImpl->mrViewContainer.begin(),
+
mpImpl->mrViewContainer.end(),
+ mpImpl->mbViewClobbered ?
+
boost::mem_fn(&View::paintScreen) :
+
boost::mem_fn(&View::updateScreen) );
+ }
+ else if( !mpImpl->maViewUpdateRequests.empty() )
+ {
+ // update notified views only
+ UpdateRequestVector::const_iterator aIter(
+ mpImpl->maViewUpdateRequests.begin() );
+ const UpdateRequestVector::const_iterator aEnd(
+ mpImpl->maViewUpdateRequests.end() );
+ while( aIter != aEnd )
+ {
+ // TODO(P1): this is O(n^2) in the number of
views, if
+ // lots of views notify updates.
+ const UnoViewVector::const_iterator aEndOfViews(
+ mpImpl->mrViewContainer.end() );
+ UnoViewVector::const_iterator aFoundView;
+ if(
(aFoundView=std::find(mpImpl->mrViewContainer.begin(),
+
aEndOfViews,
+
aIter->first)) != aEndOfViews )
+ {
+ if( aIter->second )
+ (*aFoundView)->paintScreen();
// force-paint
+ else
+ (*aFoundView)->updateScreen();
// update changes only
+ }
+
+ ++aIter;
+ }
+ }
+
+ // done - clear requests
+ mpImpl->mbViewClobbered = false;
+ mpImpl->mbUpdateAllRequest = false;
+ UpdateRequestVector().swap( mpImpl->maViewUpdateRequests );
+ }
+
+ void ScreenUpdater::addViewUpdate( ViewUpdateSharedPtr const&
rViewUpdate )
+ {
+ mpImpl->maUpdaters.add( rViewUpdate );
+ }
+
+ void ScreenUpdater::removeViewUpdate( ViewUpdateSharedPtr const&
rViewUpdate )
+ {
+ mpImpl->maUpdaters.remove( rViewUpdate );
+ }
+
+ void ScreenUpdater::requestImmediateUpdate()
+ {
+ if (mpImpl->mnLockCount > 0)
+ return;
+
+ // TODO(F2): This will interfere with other updates, since it
+ // happens out-of-sync with main animation loop. Might cause
+ // artifacts.
+ std::for_each( mpImpl->mrViewContainer.begin(),
+ mpImpl->mrViewContainer.end(),
+ boost::mem_fn(&View::updateScreen) );
+ }
+
+ void ScreenUpdater::lockUpdates (void)
+ {
+ ++mpImpl->mnLockCount;
+ OSL_ASSERT(mpImpl->mnLockCount>0);
+ }
+
+ void ScreenUpdater::unlockUpdates (void)
+ {
+ OSL_ASSERT(mpImpl->mnLockCount>0);
+ if (mpImpl->mnLockCount > 0)
+ {
+ --mpImpl->mnLockCount;
+ if (mpImpl->mnLockCount)
+ commitUpdates();
+ }
+ }
+
+ ::boost::shared_ptr<ScreenUpdater::UpdateLock>
ScreenUpdater::createLock (const bool bStartLocked)
+ {
+ return ::boost::shared_ptr<ScreenUpdater::UpdateLock>(new
::UpdateLock(*this, bStartLocked));
+ }
} // namespace internal
@@ -231,34 +230,32 @@ namespace internal
namespace {
UpdateLock::UpdateLock (
- ::slideshow::internal::ScreenUpdater& rUpdater,
- const bool bStartLocked)
- : mrUpdater(rUpdater),
- mbIsActivated(false)
+ ::slideshow::internal::ScreenUpdater& rUpdater,
+ const bool bStartLocked)
+ : mrUpdater(rUpdater),
+ mbIsActivated(false)
{
- if (bStartLocked)
- Activate();
+ if (bStartLocked)
+ Activate();
}
-
-
UpdateLock::~UpdateLock (void)
{
- if (mbIsActivated)
- mrUpdater.unlockUpdates();
+ if (mbIsActivated)
+ mrUpdater.unlockUpdates();
}
-
-
void UpdateLock::Activate (void)
{
- if ( ! mbIsActivated)
- {
- mbIsActivated = true;
- mrUpdater.lockUpdates();
- }
+ if ( ! mbIsActivated)
+ {
+ mbIsActivated = true;
+ mrUpdater.lockUpdates();
+ }
}
}
+
+/* vim: set noet sw=4 ts=4: */