Kaydet (Commit) 6a293324 authored tarafından Armin Le Grand's avatar Armin Le Grand

#i105304# corrected destructors for OverlayBase derivations

üst 602841ad
......@@ -89,6 +89,7 @@ protected:
OverlayManager. This registration is done on demand.
*/
void EnsureRegistration (void);
void RemoveRegistration();
};
......@@ -147,6 +148,7 @@ class SelectionRectangleOverlay
{
public:
SelectionRectangleOverlay (ViewOverlay& rViewOverlay);
virtual ~SelectionRectangleOverlay();
void Start (const Point& rAnchor);
void Update (const Point& rSecondCorner);
......@@ -176,6 +178,7 @@ class InsertionIndicatorOverlay
{
public:
InsertionIndicatorOverlay (ViewOverlay& rViewOverlay);
virtual ~InsertionIndicatorOverlay();
/** Given a position in model coordinates this method calculates the
insertion marker both as an index in the document and as a rectangle
......
......@@ -167,9 +167,7 @@ OverlayBase::OverlayBase (ViewOverlay& rViewOverlay)
OverlayBase::~OverlayBase (void)
{
OverlayManager* pOverlayManager = getOverlayManager();
if (pOverlayManager != NULL)
pOverlayManager->remove(*this);
OSL_ENSURE(!getOverlayManager(), "Please call RemoveRegistration() in the derived class; it's too late to call it in the base class since virtual methods will be missing when called in the destructor.");
}
......@@ -188,6 +186,16 @@ void OverlayBase::EnsureRegistration (void)
void OverlayBase::RemoveRegistration()
{
OverlayManager* pOverlayManager = getOverlayManager();
if (pOverlayManager != NULL)
pOverlayManager->remove(*this);
}
//===== SubstitutionOverlay =================================================
SubstitutionOverlay::SubstitutionOverlay (ViewOverlay& rViewOverlay)
......@@ -202,6 +210,7 @@ SubstitutionOverlay::SubstitutionOverlay (ViewOverlay& rViewOverlay)
SubstitutionOverlay::~SubstitutionOverlay (void)
{
RemoveRegistration();
}
......@@ -317,6 +326,13 @@ SelectionRectangleOverlay::SelectionRectangleOverlay (ViewOverlay& rViewOverlay)
SelectionRectangleOverlay::~SelectionRectangleOverlay()
{
RemoveRegistration();
}
Rectangle SelectionRectangleOverlay::GetSelectionRectangle (void)
{
......@@ -392,6 +408,14 @@ InsertionIndicatorOverlay::InsertionIndicatorOverlay (ViewOverlay& rViewOverlay)
InsertionIndicatorOverlay::~InsertionIndicatorOverlay()
{
RemoveRegistration();
}
void InsertionIndicatorOverlay::SetPositionAndSize (const Rectangle& aNewBoundingBox)
{
EnsureRegistration();
......@@ -510,6 +534,7 @@ MouseOverIndicatorOverlay::MouseOverIndicatorOverlay (ViewOverlay& rViewOverlay)
MouseOverIndicatorOverlay::~MouseOverIndicatorOverlay (void)
{
RemoveRegistration();
}
......
......@@ -316,6 +316,7 @@ const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
{ MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
......@@ -991,7 +992,21 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() );
break;
case WID_PAGE_NUMBER:
aAny <<= (sal_Int16)((sal_uInt16)((GetPage()->GetPageNum()-1)>>1) + 1);
{
const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
if(nPageNumber > 0)
{
// for all other pages calculate the number
aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1);
}
else
{
// for pages with number 0 (Handout Master, Handout page)
// return 0
aAny <<= (sal_Int16)0;
}
}
break;
case WID_PAGE_DURATION:
aAny <<= (sal_Int32)(GetPage()->GetTime());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment