dbaccess/source/filter/xml/xmlColumn.cxx          |    6 +++---
 dbaccess/source/filter/xml/xmlStyleImport.cxx     |    8 ++++----
 dbaccess/source/filter/xml/xmlTable.cxx           |    2 +-
 dbaccess/source/ui/dlg/ConnectionHelper.cxx       |    2 +-
 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |    4 ++--
 dbaccess/source/ui/dlg/DbAdminImpl.cxx            |    2 +-
 dbaccess/source/ui/dlg/dbadmin.cxx                |    4 ++--
 dbaccess/source/ui/dlg/dbwiz.cxx                  |    2 +-
 dbaccess/source/ui/dlg/dbwizsetup.cxx             |    2 +-
 dbaccess/source/ui/dlg/generalpage.cxx            |    2 +-
 include/tools/debug.hxx                           |    2 +-
 include/tools/inetstrm.hxx                        |    4 ++--
 include/tools/link.hxx                            |    2 +-
 include/tools/rtti.hxx                            |   13 +++++++++++--
 reportdesign/source/filter/xml/xmlCell.cxx        |    2 +-
 reportdesign/source/filter/xml/xmlColumn.cxx      |    4 ++--
 reportdesign/source/filter/xml/xmlHelper.cxx      |    2 +-
 reportdesign/source/filter/xml/xmlStyleImport.cxx |    4 ++--
 reportdesign/source/filter/xml/xmlTable.cxx       |    2 +-
 reportdesign/source/filter/xml/xmlfilter.cxx      |    2 +-
 sc/source/ui/view/viewutil.cxx                    |    2 +-
 sd/source/filter/html/htmlex.cxx                  |    2 +-
 sd/source/ui/app/tbxww.cxx                        |    2 +-
 sd/source/ui/docshell/docshell.cxx                |   12 ++++++------
 sfx2/source/appl/appopen.cxx                      |    2 +-
 sfx2/source/appl/appserv.cxx                      |    2 +-
 sfx2/source/dialog/templdlg.cxx                   |    2 +-
 sfx2/source/doc/objitem.cxx                       |    2 +-
 sfx2/source/doc/objmisc.cxx                       |    4 ++--
 sfx2/source/view/frmload.cxx                      |    2 +-
 svtools/source/misc/ehdl.cxx                      |    6 +++---
 svx/source/svdraw/svdedtv2.cxx                    |    2 +-
 svx/source/svdraw/svdomeas.cxx                    |    2 +-
 svx/source/svdraw/svdpage.cxx                     |    2 +-
 svx/source/tbxctrls/tbcontrl.cxx                  |    2 +-
 sw/inc/calbck.hxx                                 |    1 +
 sw/inc/section.hxx                                |    2 +-
 sw/inc/unoframe.hxx                               |    6 +++++-
 sw/source/core/access/accpara.cxx                 |    4 ++--
 sw/source/core/fields/docufld.cxx                 |    2 +-
 sw/source/core/layout/ssfrm.cxx                   |    2 +-
 sw/source/core/text/txtfrm.cxx                    |    2 +-
 sw/source/core/unocore/unocrsrhelper.cxx          |    2 +-
 sw/source/core/unocore/unoframe.cxx               |    2 +-
 sw/source/filter/html/htmlform.cxx                |    2 +-
 sw/source/filter/html/htmlforw.cxx                |    8 ++++----
 sw/source/filter/ww8/docxattributeoutput.cxx      |    2 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx       |    2 +-
 sw/source/filter/ww8/wrtw8esh.cxx                 |    4 ++--
 sw/source/filter/xml/xmlexpit.cxx                 |   12 ++++++------
 sw/source/filter/xml/xmlfmt.cxx                   |    4 ++--
 tools/source/debug/debug.cxx                      |    2 +-
 tools/source/generic/poly.cxx                     |   18 +++++++++---------
 tools/source/rc/resmgr.cxx                        |    6 +++---
 xmloff/source/draw/ximpshap.cxx                   |    4 ++--
 xmloff/source/draw/ximpstyl.cxx                   |    2 +-
 xmloff/source/text/XMLTextFrameContext.cxx        |    2 +-
 xmloff/source/text/txtimp.cxx                     |   16 ++++++++--------
 58 files changed, 119 insertions(+), 105 deletions(-)

New commits:
commit 23e1fc277d5651babce17bb74408ef6505f101d2
Author: Noel Grandin <n...@peralex.com>
Date:   Thu Sep 18 15:10:54 2014 +0200

    loplugin: cstylecast, update PTR_CAST macro to use static_cast
    
    I introduce a template method into the PTR_CAST machinery
    to maintain constness.
    There is now a FIXME in sd/../docshell.cxx because I needed
    to use a dynamic_cast there to work around the games it appears
    to be playing with OLE in-place activation.
    
    Signed-off-by: Stephan Bergmann <sberg...@redhat.com>,
    dropping the GCC-extension, unnecessary use of typeof from tools/rtti.hxx
    
    Change-Id: Iba5ace1aa27e02b34fcc91af1e658c43371afd03

diff --git a/dbaccess/source/filter/xml/xmlColumn.cxx 
b/dbaccess/source/filter/xml/xmlColumn.cxx
index d055cda..247dc75 100644
--- a/dbaccess/source/filter/xml/xmlColumn.cxx
+++ b/dbaccess/source/filter/xml/xmlColumn.cxx
@@ -130,7 +130,7 @@ void OXMLColumn::EndElement()
                 const SvXMLStylesContext* pAutoStyles = 
GetOwnImport().GetAutoStyles();
                 if ( pAutoStyles )
                 {
-                    OTableStyleContext* pAutoStyle = 
PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN,m_sStyleName));
+                    OTableStyleContext* pAutoStyle = 
const_cast<OTableStyleContext*>(PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN,m_sStyleName)));
                     if ( pAutoStyle )
                     {
                         pAutoStyle->FillPropertySet(xProp);
@@ -142,7 +142,7 @@ void OXMLColumn::EndElement()
                 const SvXMLStylesContext* pAutoStyles = 
GetOwnImport().GetAutoStyles();
                 if ( pAutoStyles )
                 {
-                    OTableStyleContext* pAutoStyle = 
PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName));
+                    OTableStyleContext* pAutoStyle = 
const_cast<OTableStyleContext*>(PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName)));
                     if ( pAutoStyle )
                     {
                         pAutoStyle->FillPropertySet(xProp);
@@ -159,7 +159,7 @@ void OXMLColumn::EndElement()
         const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles();
         if ( pAutoStyles )
         {
-            OTableStyleContext* pAutoStyle = 
PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName));
+            OTableStyleContext* pAutoStyle = 
const_cast<OTableStyleContext*>(PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sCellStyleName)));
             if ( pAutoStyle )
             {
                 // we also have to do this on the table to import 
text-properties
diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx 
b/dbaccess/source/filter/xml/xmlStyleImport.cxx
index 932f5cf..1dab32f 100644
--- a/dbaccess/source/filter/xml/xmlStyleImport.cxx
+++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx
@@ -84,14 +84,14 @@ void OTableStyleContext::FillPropertySet(
         {
             if ((m_nNumberFormat == -1) && !m_sDataStyleName.isEmpty())
             {
-                SvXMLNumFormatContext* pStyle = 
PTR_CAST(SvXMLNumFormatContext,pStyles->FindStyleChildContext(
-                    XML_STYLE_FAMILY_DATA_STYLE, m_sDataStyleName, true));
+                SvXMLNumFormatContext* pStyle = 
const_cast<SvXMLNumFormatContext*>(PTR_CAST(SvXMLNumFormatContext,pStyles->FindStyleChildContext(
+                    XML_STYLE_FAMILY_DATA_STYLE, m_sDataStyleName, true)));
                 if ( !pStyle )
                 {
                     OTableStylesContext* pMyStyles = 
PTR_CAST(OTableStylesContext,GetOwnImport().GetAutoStyles());
                     if ( pMyStyles )
-                        pStyle = PTR_CAST(SvXMLNumFormatContext,pMyStyles->
-                            FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, 
m_sDataStyleName, true));
+                        pStyle = 
const_cast<SvXMLNumFormatContext*>(PTR_CAST(SvXMLNumFormatContext,pMyStyles->
+                            FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, 
m_sDataStyleName, true)));
                     else {
                         OSL_FAIL("not possible to get style");
                     }
diff --git a/dbaccess/source/filter/xml/xmlTable.cxx 
b/dbaccess/source/filter/xml/xmlTable.cxx
index dcc8b57..c3478a3 100644
--- a/dbaccess/source/filter/xml/xmlTable.cxx
+++ b/dbaccess/source/filter/xml/xmlTable.cxx
@@ -193,7 +193,7 @@ void OXMLTable::EndElement()
                     const SvXMLStylesContext* pAutoStyles = 
GetOwnImport().GetAutoStyles();
                     if ( pAutoStyles )
                     {
-                        OTableStyleContext* pAutoStyle = 
PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_TABLE,m_sStyleName));
+                        OTableStyleContext* pAutoStyle = 
const_cast<OTableStyleContext*>(PTR_CAST(OTableStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_TABLE,m_sStyleName)));
                         if ( pAutoStyle )
                         {
                             pAutoStyle->FillPropertySet(m_xTable);
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx 
b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index b31c067..0c404dc 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -99,7 +99,7 @@ namespace dbaui
         get(m_pPB_CreateDB, "create");
 
         // extract the datasource type collection from the item set
-        DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rCoreAttrs.GetItem(DSID_TYPECOLLECTION));
+        const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rCoreAttrs.GetItem(DSID_TYPECOLLECTION));
         if (pCollectionItem)
             m_pCollection = pCollectionItem->getCollection();
         m_pPB_Connection->SetClickHdl(LINK(this, OConnectionHelper, 
OnBrowseConnections));
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx 
b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index ceef0fe..523b1aa 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -159,7 +159,7 @@ using namespace ::com::sun::star;
 
         if ( m_pETHostServer->IsValueChangedFromSaved() )
         {
-            DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rSet->GetItem(DSID_TYPECOLLECTION));
+            const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rSet->GetItem(DSID_TYPECOLLECTION));
             ::dbaccess::ODsnTypeCollection* pCollection = NULL;
             if (pCollectionItem)
                 pCollection = pCollectionItem->getCollection();
@@ -249,7 +249,7 @@ using namespace ::com::sun::star;
     void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, bool 
/*_bSaveValue*/)
     {
         // show the "Connect directly" option only if the driver is installed
-        DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
+        const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
         bool bHasMySQLNative = ( pCollectionItem != NULL ) && 
pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" );
         if ( bHasMySQLNative )
             m_pNATIVEDatabase->Show();
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx 
b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index f459c81..fd56da8 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -1116,7 +1116,7 @@ DbuTypeCollectionItem::DbuTypeCollectionItem(const 
DbuTypeCollectionItem& _rSour
 
 bool DbuTypeCollectionItem::operator==(const SfxPoolItem& _rItem) const
 {
-    DbuTypeCollectionItem* pCompare = PTR_CAST(DbuTypeCollectionItem, &_rItem);
+    const DbuTypeCollectionItem* pCompare = PTR_CAST(DbuTypeCollectionItem, 
&_rItem);
     return pCompare && (pCompare->getCollection() == getCollection());
 }
 
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx 
b/dbaccess/source/ui/dlg/dbadmin.cxx
index ff60c14..646db7c 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -104,7 +104,7 @@ void ODbAdminDialog::impl_selectDataSource(const 
::com::sun::star::uno::Any& _aD
     Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
     impl_resetPages( xDatasource );
 
-    DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, 
getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+    const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
     ::dbaccess::ODsnTypeCollection* pCollection = 
pCollectionItem->getCollection();
     ::dbaccess::DATASOURCE_TYPE eType = 
pCollection->determineType(getDatasourceType(*getOutputSet()));
 
@@ -196,7 +196,7 @@ void ODbAdminDialog::impl_resetPages(const Reference< 
XPropertySet >& _rxDatasou
 
     // special case: MySQL Native does not have the generic "advanced" page
 
-    DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, 
getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+    const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
     ::dbaccess::ODsnTypeCollection* pCollection = 
pCollectionItem->getCollection();
     if ( pCollection->determineType(getDatasourceType( *pExampleSet )) == 
::dbaccess::DST_MYSQL_NATIVE )
     {
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index 00dcddd..27c57af 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -93,7 +93,7 @@ ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent
     m_pHelp->SetUniqueId(UID_DBWIZ_HELP);
     // no local resources needed anymore
 
-    DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, 
_pItems->GetItem(DSID_TYPECOLLECTION));
+    const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _pItems->GetItem(DSID_TYPECOLLECTION));
     m_pCollection = pCollectionItem->getCollection();
 
     ActivatePage();
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx 
b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 5649db4..2922922 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -134,7 +134,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(vcl::Window* 
_pParent
 {
     // no local resources needed anymore
     // extract the datasource type collection from the item set
-    DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, 
_pItems->GetItem(DSID_TYPECOLLECTION));
+    const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _pItems->GetItem(DSID_TYPECOLLECTION));
     if (pCollectionItem)
         m_pCollection = pCollectionItem->getCollection();
 
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx 
b/dbaccess/source/ui/dlg/generalpage.cxx
index 29b08e0..3a980d5 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -65,7 +65,7 @@ namespace dbaui
         get( m_pSpecialMessage, "specialMessage" );
 
         // extract the datasource type collection from the item set
-        DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rItems.GetItem(DSID_TYPECOLLECTION));
+        const DbuTypeCollectionItem* pCollectionItem = 
PTR_CAST(DbuTypeCollectionItem, _rItems.GetItem(DSID_TYPECOLLECTION));
         if (pCollectionItem)
             m_pCollection = pCollectionItem->getCollection();
         SAL_WARN_IF(!m_pCollection, "dbaccess", "OGeneralPage::OGeneralPage : 
really need a DSN type collection !");
diff --git a/include/tools/debug.hxx b/include/tools/debug.hxx
index b80d0f0..050dc34 100644
--- a/include/tools/debug.hxx
+++ b/include/tools/debug.hxx
@@ -98,7 +98,7 @@ inline sal_uIntPtr DbgIsBoldAppFont()
 
 inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc )
 {
-    DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, (void*)(long)pProc );
+    DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, 
reinterpret_cast<void*>(reinterpret_cast<long>(pProc)) );
 }
 
 #define DBG_ASSERTWARNING( sCon, aWarning ) \
diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx
index 89c715f..e2dfc72 100644
--- a/include/tools/inetstrm.hxx
+++ b/include/tools/inetstrm.hxx
@@ -203,7 +203,7 @@ public:
     }
     INetMIMEMessage *GetSourceMessage (void) const
     {
-        return ((INetMIMEMessage *)INetMessageIStream::GetSourceMessage());
+        return static_cast<INetMIMEMessage 
*>(INetMessageIStream::GetSourceMessage());
     }
 
     using INetMessageOStream::SetTargetMessage;
@@ -213,7 +213,7 @@ public:
     }
     INetMIMEMessage *GetTargetMessage (void) const
     {
-        return ((INetMIMEMessage *)INetMessageOStream::GetTargetMessage());
+        return static_cast<INetMIMEMessage 
*>(INetMessageOStream::GetTargetMessage());
     }
 };
 
diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index c603c0e..9b7e7fe 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -119,7 +119,7 @@ public:
     bool            operator!=( const Link& rLink ) const
                     { return !(Link::operator==( rLink )); }
     bool            operator<( const Link& rLink ) const
-                    { return ((sal_uIntPtr)rLink.pFunc < (sal_uIntPtr)pFunc); }
+                    { return reinterpret_cast<sal_uIntPtr>(rLink.pFunc) < 
reinterpret_cast<sal_uIntPtr>(pFunc); }
 };
 
 inline Link::Link()
diff --git a/include/tools/rtti.hxx b/include/tools/rtti.hxx
index 0a5696b..92555a2 100644
--- a/include/tools/rtti.hxx
+++ b/include/tools/rtti.hxx
@@ -122,8 +122,17 @@ typedef void* (*TypeId)();
     T: Target type to cast into
     p: Pointer to be cast into T
 */
-#define PTR_CAST( T, pObj ) \
-        ( pObj && (pObj)->IsA( TYPE(T) ) ? (T*)(pObj) : 0 )
+#define PTR_CAST( T, pObj ) rttiCast<T>(pObj, TYPE(T))
+
+template<class T1, class T2>
+inline T1* rttiCast(T2* pObj, const TypeId& rTypeId) {
+    return (pObj && pObj->IsA( rTypeId )) ? static_cast<T1*>(pObj) : 0;
+};
+
+template<class T1, class T2>
+inline const T1* rttiCast(const T2* pObj, const TypeId& rTypeId) {
+    return (pObj && pObj->IsA( rTypeId )) ? static_cast<const T1*>(pObj) : 0;
+};
 
 /** Check whether object pObj has a Base Class T
     (or if pObj is an instance of T) */
diff --git a/reportdesign/source/filter/xml/xmlCell.cxx 
b/reportdesign/source/filter/xml/xmlCell.cxx
index fe00d4a..d7e7c8d 100644
--- a/reportdesign/source/filter/xml/xmlCell.cxx
+++ b/reportdesign/source/filter/xml/xmlCell.cxx
@@ -218,7 +218,7 @@ void OXMLCell::EndElement()
         m_xComponent = xFixedLine.get();
         m_pContainer->getSection()->add(m_xComponent.get());
         m_pContainer->addCell(m_xComponent);
-        XMLPropStyleContext* pAutoStyle = 
PTR_CAST(XMLPropStyleContext,GetImport().GetAutoStyles()->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sStyleName));
+        XMLPropStyleContext* pAutoStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,GetImport().GetAutoStyles()->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,m_sStyleName)));
         if ( pAutoStyle )
         {
             uno::Reference<beans::XPropertySet> xBorderProp = 
OXMLHelper::createBorderPropertySet();
diff --git a/reportdesign/source/filter/xml/xmlColumn.cxx 
b/reportdesign/source/filter/xml/xmlColumn.cxx
index 7a92e7c..e9a558b 100644
--- a/reportdesign/source/filter/xml/xmlColumn.cxx
+++ b/reportdesign/source/filter/xml/xmlColumn.cxx
@@ -136,7 +136,7 @@ void OXMLRowColumn::fillStyle(const OUString& _sStyleName)
             };
             pInfo->add(pMap);
             Reference<XPropertySet> xProp = 
GenericPropertySet_CreateInstance(pInfo);
-            XMLPropStyleContext* pAutoStyle = 
PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN,_sStyleName));
+            XMLPropStyleContext* pAutoStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN,_sStyleName)));
             if ( pAutoStyle )
             {
                 pAutoStyle->FillPropertySet(xProp);
@@ -146,7 +146,7 @@ void OXMLRowColumn::fillStyle(const OUString& _sStyleName)
             }
             else
             {
-                pAutoStyle = 
PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_ROW,_sStyleName));
+                pAutoStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_ROW,_sStyleName)));
                 if ( pAutoStyle )
                 {
                     pAutoStyle->FillPropertySet(xProp);
diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx 
b/reportdesign/source/filter/xml/xmlHelper.cxx
index 669e520..e2c5754 100644
--- a/reportdesign/source/filter/xml/xmlHelper.cxx
+++ b/reportdesign/source/filter/xml/xmlHelper.cxx
@@ -252,7 +252,7 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const 
OUString& _sStyleName,
 {
     if ( !_xProp.is() || _sStyleName.isEmpty() || !_pAutoStyles )
         return;
-    XMLPropStyleContext* pAutoStyle = 
PTR_CAST(XMLPropStyleContext,_pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,_sStyleName));
+    XMLPropStyleContext* pAutoStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,_pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,_sStyleName)));
     if ( pAutoStyle )
     {
         ::com::sun::star::awt::FontDescriptor aFont;
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx 
b/reportdesign/source/filter/xml/xmlStyleImport.cxx
index 9e47479..8ee64b0 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.cxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx
@@ -107,8 +107,8 @@ void OControlStyleContext::FillPropertySet(const Reference< 
XPropertySet > & rPr
                 {
                     OReportStylesContext* pMyStyles = 
PTR_CAST(OReportStylesContext,GetOwnImport().GetAutoStyles());
                     if ( pMyStyles )
-                        pStyle = PTR_CAST(SvXMLNumFormatContext,pMyStyles->
-                            FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, 
m_sDataStyleName, true));
+                        pStyle = 
const_cast<SvXMLNumFormatContext*>(PTR_CAST(SvXMLNumFormatContext,pMyStyles->
+                            FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, 
m_sDataStyleName, true)));
                     else {
                         OSL_FAIL("not possible to get style");
                     }
diff --git a/reportdesign/source/filter/xml/xmlTable.cxx 
b/reportdesign/source/filter/xml/xmlTable.cxx
index 4cb109d..8af0b10 100644
--- a/reportdesign/source/filter/xml/xmlTable.cxx
+++ b/reportdesign/source/filter/xml/xmlTable.cxx
@@ -171,7 +171,7 @@ void OXMLTable::EndElement()
                 const SvXMLStylesContext* pAutoStyles = 
GetImport().GetAutoStyles();
                 if ( pAutoStyles )
                 {
-                    XMLPropStyleContext* pAutoStyle = 
PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_TABLE,m_sStyleName));
+                    XMLPropStyleContext* pAutoStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_TABLE,m_sStyleName)));
                     if ( pAutoStyle )
                     {
                         pAutoStyle->FillPropertySet(m_xSection.get());
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx 
b/reportdesign/source/filter/xml/xmlfilter.cxx
index 217a84c..73b361a 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -641,7 +641,7 @@ SvXMLImportContext* ORptFilter::CreateContext( sal_uInt16 
nPrefix,
                 const SvXMLStylesContext* pAutoStyles = GetAutoStyles();
                 if ( pAutoStyles )
                 {
-                    XMLPropStyleContext* pAutoStyle = 
PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_PAGE_MASTER,OUString("pm1")));
+                    XMLPropStyleContext* pAutoStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_PAGE_MASTER,OUString("pm1"))));
                     if ( pAutoStyle )
                     {
                         
pAutoStyle->FillPropertySet(getReportDefinition().get());
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 628c735..aee4241 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -77,7 +77,7 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, 
const ScAddress& rPos )
     sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? 
ATTR_CJK_FONT_LANGUAGE :
                     ( ( nScript == SCRIPTTYPE_COMPLEX ) ? 
ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE );
     const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), 
rPos.Tab(), nWhich);
-    SvxLanguageItem* pLangIt = PTR_CAST( SvxLanguageItem, pItem );
+    const SvxLanguageItem* pLangIt = PTR_CAST( SvxLanguageItem, pItem );
     LanguageType eLnge;
     if (pLangIt)
     {
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index ca11bcd..389ca50 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1467,7 +1467,7 @@ OUString HtmlExport::TextAttribToHTMLString( SfxItemSet* 
pSet, HtmlState* pState
         SvxFieldItem* pItem = (SvxFieldItem*)pSet->GetItem( EE_FEATURE_FIELD );
         if(pItem)
         {
-            SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField());
+            const SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField());
             if(pURL)
             {
                 aLink = pURL->GetURL();
diff --git a/sd/source/ui/app/tbxww.cxx b/sd/source/ui/app/tbxww.cxx
index e48084f..40ee52f 100644
--- a/sd/source/ui/app/tbxww.cxx
+++ b/sd/source/ui/app/tbxww.cxx
@@ -134,7 +134,7 @@ void SdTbxControl::StateChanged( sal_uInt16 nSId,
 
     if( eState == SfxItemState::DEFAULT )
     {
-        TbxImageItem* pItem = PTR_CAST( TbxImageItem, pState );
+        const TbxImageItem* pItem = PTR_CAST( TbxImageItem, pState );
         // StarDesktop can also receive another item,
         // but it is not allowed to evaluate it
         if( pItem )
diff --git a/sd/source/ui/docshell/docshell.cxx 
b/sd/source/ui/docshell/docshell.cxx
index a184ccf..0b9e31c 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -285,8 +285,6 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
 
 void DrawDocShell::InPlaceActivate( bool bActive )
 {
-    ViewShell* pViewSh = NULL;
-    SfxViewShell* pSfxViewSh = NULL;
     SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false);
     std::vector<FrameView*> &rViews = mpDoc->GetFrameViewList();
 
@@ -301,8 +299,9 @@ void DrawDocShell::InPlaceActivate( bool bActive )
         while (pSfxViewFrame)
         {
             // determine the number of FrameViews
-            pSfxViewSh = pSfxViewFrame->GetViewShell();
-            pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
+            SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell();
+            // FIXME this used to be a PTR_CAST, but when I updated the macro, 
I discovered that SfxViewShell is not statically castable to sd::ViewShell
+            ViewShell* pViewSh = (pSfxViewSh && pSfxViewSh->IsA( 
TYPE(ViewShell) )) ? dynamic_cast<ViewShell*>(pSfxViewSh) : 0;
 
             if ( pViewSh && pViewSh->GetFrameView() )
             {
@@ -321,8 +320,9 @@ void DrawDocShell::InPlaceActivate( bool bActive )
         for( sal_uInt32 i = 0; pSfxViewFrame && (i < rViews.size()); i++ )
         {
             // determine the number of FrameViews
-            pSfxViewSh = pSfxViewFrame->GetViewShell();
-            pViewSh = PTR_CAST( ViewShell, pSfxViewSh );
+            SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell();
+            // FIXME this used to be a PTR_CAST, but when I updated the macro, 
I discovered that SfxViewShell is not statically castable to sd::ViewShell
+            ViewShell* pViewSh = (pSfxViewSh && pSfxViewSh->IsA( 
TYPE(ViewShell) )) ? dynamic_cast<ViewShell*>(pSfxViewSh) : 0;
 
             if ( pViewSh )
             {
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 22908fa..e675f38 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -327,7 +327,7 @@ sal_uIntPtr SfxApplication::LoadTemplate( 
SfxObjectShellLock& xDoc, const OUStri
         const SfxPoolItem *pRet = GetDispatcher_Impl()->Execute( SID_OPENDOC, 
SFX_CALLMODE_SYNCHRON, &aName, &aHidden, &aReferer, &aFlags, 0L );
         const SfxObjectItem *pObj = PTR_CAST( SfxObjectItem, pRet );
         if ( pObj )
-            xDoc = PTR_CAST( SfxObjectShell, pObj->GetShell() );
+            xDoc = const_cast<SfxObjectShell*>(PTR_CAST( SfxObjectShell, 
pObj->GetShell() ));
         else
         {
             const SfxViewFrameItem *pView = PTR_CAST( SfxViewFrameItem, pRet );
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 7798695..f5624bc 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -419,7 +419,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
                 if ( pObjSh->IsModified() )
                 {
                     pObjSh->ExecuteSlot( aReq );
-                    SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, 
aReq.GetReturnValue() );
+                    const SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, 
aReq.GetReturnValue() );
                     if ( !pItem || !pItem->GetValue() )
                         bOK = false;
                 }
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 7aac28c..45db4a6 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1718,7 +1718,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl(
 
     if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || 
aFmtLb.GetSelectionCount() <= 1) )
     {
-        SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem);
+        const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem);
         OSL_ENSURE(pFilterItem, "SfxUINT16Item expected");
         sal_uInt16 nFilterFlags = pFilterItem->GetValue() & 
~SFXSTYLEBIT_USERDEF;
         if(!nFilterFlags)       // User Template?
diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx
index 15798ae..b5c8fa0 100644
--- a/sfx2/source/doc/objitem.cxx
+++ b/sfx2/source/doc/objitem.cxx
@@ -109,7 +109,7 @@ SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell 
*pSh )
 
 bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
 {
-     SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem);
+     const SfxObjectItem *pOther = PTR_CAST(SfxObjectItem, &rItem);
      return pOther->_pSh == _pSh;
 }
 
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 4b99eee..f96ae3d 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -523,7 +523,7 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool 
bSave )
             {
                 // TODO/LATER: currently the application guards against the 
reentrance problem
                 const SfxPoolItem* pItem = 
pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : 
SID_SAVEASDOC );
-                SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem );
+                const SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem );
                 bResult = ( pResult && pResult->GetValue() );
                 if ( bResult )
                     aOrigURL = GetMedium()->GetURLObject().GetMainURL( 
INetURLObject::NO_DECODE );
@@ -557,7 +557,7 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool 
bSave )
                 // TODO/LATER: currently the application guards against the 
reentrance problem
                 SetModified( true ); // the modified flag has to be set to let 
the document be stored with the shared flag
                 const SfxPoolItem* pItem = 
pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : 
SID_SAVEASDOC );
-                SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem );
+                const SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem );
                 bResult = ( pResult && pResult->GetValue() );
             }
         }
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 4dec0d6..5219723 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -331,7 +331,7 @@ namespace
 
         // On the other side some special slots return a boolean state,
         // which can be set to FALSE.
-        SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult );
+        const SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult );
         if ( pItem )
             bSuccess = pItem->GetValue();
 
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 4a6afd5..1be2f4e 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -176,7 +176,7 @@ bool SfxErrorHandler::CreateString(
     sal_uLong nErrCode = pErr->GetErrorCode() & ERRCODE_ERROR_MASK;
     if( nErrCode>=lEnd || nErrCode<=lStart )
         return false;
-    MessageInfo *pMsgInfo=PTR_CAST(MessageInfo,pErr);
+    const MessageInfo *pMsgInfo = PTR_CAST(MessageInfo,pErr);
     if(pMsgInfo)
     {
         if(GetMessageString(nErrCode, rStr, nFlags))
@@ -187,7 +187,7 @@ bool SfxErrorHandler::CreateString(
     }
     else if(GetErrorString(nErrCode, rStr, nFlags))
     {
-        StringErrorInfo *pStringInfo=PTR_CAST(StringErrorInfo,pErr);
+        const StringErrorInfo *pStringInfo = PTR_CAST(StringErrorInfo,pErr);
         if(pStringInfo)
         {
             rStr = rStr.replaceAll(OUString("$(ARG1)"),
@@ -195,7 +195,7 @@ bool SfxErrorHandler::CreateString(
         }
         else
         {
-            TwoStringErrorInfo * pTwoStringInfo = PTR_CAST(TwoStringErrorInfo,
+            const TwoStringErrorInfo * pTwoStringInfo = 
PTR_CAST(TwoStringErrorInfo,
                                                            pErr);
             if (pTwoStringInfo)
             {
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 693268d..81ad4d8 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -614,7 +614,7 @@ bool SdrEditView::ImpCanConvertForCombine(const SdrObject* 
pObj) const
 basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon1(const SdrObject* pObj, 
bool bCombine) const
 {
     basegfx::B2DPolyPolygon aRetval;
-    SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj);
+    const SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj);
 
     if(bCombine && pPath && !pObj->GetOutlinerParaObject())
     {
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index a106396..007c973 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -587,7 +587,7 @@ bool SdrMeasureObj::CalcFieldValue(const SvxFieldItem& 
rField, sal_Int32 nPara,
     Color*& rpTxtColor, Color*& rpFldColor, OUString& rRet) const
 {
     const SvxFieldData* pField=rField.GetField();
-    SdrMeasureField* pMeasureField=PTR_CAST(SdrMeasureField,pField);
+    const SdrMeasureField* pMeasureField=PTR_CAST(SdrMeasureField,pField);
     if (pMeasureField!=NULL) {
         rRet = TakeRepresentation(pMeasureField->GetMeasureFieldKind());
         if (rpFldColor!=NULL) {
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index efd8d16..966ca34 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -154,7 +154,7 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
     if (nCloneErrCnt==0) {
         for (size_t no=0; no<nAnz; ++no) {
             const SdrObject* pSrcOb=rSrcList.GetObj(no);
-            SdrEdgeObj* pSrcEdge=PTR_CAST(SdrEdgeObj,pSrcOb);
+            const SdrEdgeObj* pSrcEdge=PTR_CAST(SdrEdgeObj,pSrcOb);
             if (pSrcEdge!=NULL) {
                 SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(true);
                 SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(false);
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 764aafa..63d28d9 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2479,7 +2479,7 @@ 
SvxSimpleUndoRedoController::~SvxSimpleUndoRedoController()
 
 void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState 
eState, const SfxPoolItem* pState )
 {
-    SfxStringItem* pItem = PTR_CAST( SfxStringItem, pState );
+    const SfxStringItem* pItem = PTR_CAST( SfxStringItem, pState );
     ToolBox& rBox = GetToolBox();
     if ( pItem && eState != SfxItemState::DISABLED )
     {
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 45156ac..3f6ca20 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -101,6 +101,7 @@ public:
    void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { 
SwClientNotify( rModify, rHint ); }
 
     const SwModify* GetRegisteredIn() const { return pRegisteredIn; }
+    SwModify* GetRegisteredIn() { return pRegisteredIn; }
     bool IsLast() const { return !pLeft && !pRight; }
 
     // needed for class SwClientIter
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index 833c681..418319a 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -359,7 +359,7 @@ inline SwSectionFmt* SwSectionFmt::GetParent() const
 {
     SwSectionFmt* pRet = 0;
     if( GetRegisteredIn() )
-        pRet = PTR_CAST( SwSectionFmt, GetRegisteredIn() );
+        pRet = const_cast<SwSectionFmt*>(PTR_CAST( SwSectionFmt, 
GetRegisteredIn() ));
     return pRet;
 }
 
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 3e5bb97..d9a012c 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -141,7 +141,11 @@ public:
     void attachToRange(const ::com::sun::star::uno::Reference< 
::com::sun::star::text::XTextRange > & xTextRange)throw( 
::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException );
     void attach( const ::com::sun::star::uno::Reference< 
::com::sun::star::text::XTextRange >& xTextRange ) 
throw(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException);
 
-    SwFrmFmt*       GetFrmFmt() const
+    const SwFrmFmt* GetFrmFmt() const
+    {
+        return PTR_CAST ( SwFrmFmt, GetRegisteredIn() );
+    }
+    SwFrmFmt* GetFrmFmt()
     {
         return PTR_CAST ( SwFrmFmt, GetRegisteredIn() );
     }
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 3d650b1..dee3966 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -162,7 +162,7 @@ sal_Int32 SwAccessibleParagraph::GetCaretPos()
             if(!GetPortionData().IsValidCorePosition( nIndex ) ||
                 ( GetPortionData().IsZeroCorePositionData() && nIndex== 0) )
             {
-                SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
+                const SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
                 bool bFormat = (pTxtFrm && pTxtFrm->HasPara());
                 if(bFormat)
                 {
@@ -946,7 +946,7 @@ lang::Locale SAL_CALL SwAccessibleParagraph::getLocale 
(void)
 {
     SolarMutexGuard aGuard;
 
-    SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
+    const SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
     if( !pTxtFrm )
     {
         THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (no text 
frame)" );
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index 01d13de..0289c2c 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -155,7 +155,7 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc,
             if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem2( RES_PAGEDESC, n 
) )
                 && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
             {
-                SwCntntNode* pNd = PTR_CAST( SwCntntNode, 
pDesc->GetDefinedIn() );
+                const SwCntntNode* pNd = PTR_CAST( SwCntntNode, 
pDesc->GetDefinedIn() );
                 if( pNd )
                 {
                     if ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*pNd) )
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 714ef7a..3d94b59 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -423,7 +423,7 @@ SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt, SwFrm* 
pSib ) :
 
 SwCntntFrm::~SwCntntFrm()
 {
-    SwCntntNode* pCNd;
+    const SwCntntNode* pCNd;
     if( 0 != ( pCNd = PTR_CAST( SwCntntNode, GetRegisteredIn() )) &&
         !pCNd->GetDoc()->IsInDtor() )
     {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index d2951ff..389127d 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -371,7 +371,7 @@ SwTxtFrm::~SwTxtFrm()
     // Remove associated SwParaPortion from pTxtCache
     ClearPara();
 
-    SwCntntNode* pCNd;
+    const SwCntntNode* pCNd;
     if( 0 != ( pCNd = PTR_CAST( SwCntntNode, GetRegisteredIn() )) &&
         !pCNd->GetDoc()->IsInDtor() && HasFtn() )
     {
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index b4ef131..2207df9 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -191,7 +191,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> 
const& xIfc,
         ::sw::UnoTunnelGetImplementation<SwXFrame>(xTunnel));
     if (pFrame)
     {
-        SwFrmFmt *const pFrmFmt(pFrame->GetFrmFmt());
+        const SwFrmFmt *const pFrmFmt(pFrame->GetFrmFmt());
         if (pFrmFmt && pFrmFmt->GetDoc() == &rTargetDoc)
         {
             o_rFrame = std::make_pair(pFrmFmt->GetName(), 
pFrame->GetFlyCntType());
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index d3e0fbe..31e00cf 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -3183,7 +3183,7 @@ const SwStartNode *SwXTextFrame::GetStartNode() const
 {
     const SwStartNode *pSttNd = 0;
 
-    SwFrmFmt* pFmt = GetFrmFmt();
+    const SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt)
     {
         const SwFmtCntnt& rFlyCntnt = pFmt->GetCntnt();
diff --git a/sw/source/filter/html/htmlform.cxx 
b/sw/source/filter/html/htmlform.cxx
index e198c73..b4353db 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -687,7 +687,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< 
drawing::XShape >& rSha
 
     const SdrView* pDrawView = pVSh ? pVSh->GetDrawView() : 0;
 
-    SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
+    const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
     uno::Reference< awt::XControl > xControl;
     if ( pDrawView && pVSh->GetWin() && pFormObj )
         xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() );
diff --git a/sw/source/filter/html/htmlforw.cxx 
b/sw/source/filter/html/htmlforw.cxx
index 47d6f17..4fc3adf 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -642,7 +642,7 @@ const SdrObject *SwHTMLWriter::GetHTMLControl( const 
SwDrawFrmFmt& rFmt )
     if( !pObj || FmFormInventor != pObj->GetObjInventor() )
         return 0;
 
-    SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
+    const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
     assert(pFormObj);
     if (!pFormObj)
         return 0;
@@ -676,7 +676,7 @@ static void GetControlSize( const SdrObject& rSdrObj, Size& 
rSz,
     if( !pVSh )
         return;
 
-    SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObj );
+    const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObj );
     assert(pFormObj);
     if (!pFormObj)
         return;
@@ -703,7 +703,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt,
 {
     SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
 
-    SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObject );
+    const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObject );
     assert(pFormObj);
     if (!pFormObj)
         return rWrt;
@@ -1292,7 +1292,7 @@ static void AddControl( HTMLControls& rControls,
                         const SdrObject *pSdrObj,
                         sal_uInt32 nNodeIdx )
 {
-    SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pSdrObj );
+    const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pSdrObj );
     assert(pFormObj); //Doch kein FormObj
     if (!pFormObj)
         return;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4bdb9db..25554fb 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4429,7 +4429,7 @@ void DocxAttributeOutput::WritePostponedFormControl(const 
SdrObject* pObject)
 {
     if (pObject && pObject->GetObjInventor() == FmFormInventor)
     {
-        if (SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject))
+        if (SdrUnoObj *pFormObj = 
const_cast<SdrUnoObj*>(PTR_CAST(SdrUnoObj,pObject)))
         {
             uno::Reference<awt::XControlModel> xControlModel = 
pFormObj->GetUnoControlModel();
             uno::Reference<lang::XServiceInfo> xInfo(xControlModel, 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 653c5ad..7beef00 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1752,7 +1752,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const 
sw::Frame& rFrame, const Poin
 
         if (pObject && pObject->GetObjInventor() == FmFormInventor)
         {
-            if (SdrUnoObj* pFormObj = PTR_CAST(SdrUnoObj,pObject))
+            if (const SdrUnoObj* pFormObj = PTR_CAST(SdrUnoObj,pObject))
             {
                 uno::Reference< awt::XControlModel > xControlModel =
                     pFormObj->GetUnoControlModel();
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 79a32b0..fd009df 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -370,7 +370,7 @@ bool WW8Export::MiserableFormFieldExportHack(const 
SwFrmFmt& rFrmFmt)
     const SdrObject *pObject = rFrmFmt.FindRealSdrObject();
     if (pObject && pObject->GetObjInventor() == FmFormInventor)
     {
-        if (SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject))
+        if (const SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject))
         {
             uno::Reference< awt::XControlModel > xControlModel =
                 pFormObj->GetUnoControlModel();
@@ -3112,7 +3112,7 @@ bool SwMSConvertControls::ExportControl(WW8Export 
&rWW8Wrt, const SdrObject *pOb
     if (!rWW8Wrt.bWrtWW8)
         return false;
 
-    SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObj);
+    const SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObj);
     assert(pFormObj);
     if (!pFormObj)
         return false;
diff --git a/sw/source/filter/xml/xmlexpit.cxx 
b/sw/source/filter/xml/xmlexpit.cxx
index cdd9cd0..40253fe 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -536,7 +536,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 
         case RES_BOX:
         {
-            SvxBoxItem* pBox = PTR_CAST(SvxBoxItem, &rItem);
+            const SvxBoxItem* pBox = PTR_CAST(SvxBoxItem, &rItem);
             assert(pBox && "Wrong Which-ID");
             if (pBox)
             {
@@ -874,7 +874,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 
         case RES_KEEP:
         {
-            SvxFmtKeepItem* pFmtKeep = PTR_CAST(SvxFmtKeepItem, &rItem);
+            const SvxFmtKeepItem* pFmtKeep = PTR_CAST(SvxFmtKeepItem, &rItem);
             assert(pFmtKeep && "Wrong Which-ID");
             if (pFmtKeep)
             {
@@ -888,7 +888,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 
         case RES_BACKGROUND:
         {
-            SvxBrushItem* pBrush = PTR_CAST(SvxBrushItem, &rItem);
+            const SvxBrushItem* pBrush = PTR_CAST(SvxBrushItem, &rItem);
             OSL_ENSURE( pBrush != NULL, "Wrong Which-ID" );
 
             // note: the graphic is only exported if nMemberId equals
@@ -1038,7 +1038,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 
         case RES_HORI_ORIENT:
         {
-            SwFmtHoriOrient* pHoriOrient = PTR_CAST(SwFmtHoriOrient, &rItem);
+            const SwFmtHoriOrient* pHoriOrient = PTR_CAST(SwFmtHoriOrient, 
&rItem);
             assert(pHoriOrient && "Wrong Which-ID");
             if (pHoriOrient)
             {
@@ -1051,7 +1051,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 
         case RES_VERT_ORIENT:
         {
-            SwFmtVertOrient* pVertOrient = PTR_CAST(SwFmtVertOrient, &rItem);
+            const SwFmtVertOrient* pVertOrient = PTR_CAST(SwFmtVertOrient, 
&rItem);
             assert(pVertOrient && "Wrong Which-ID");
 
             SvXMLUnitConverter::convertEnum( aOut, 
pVertOrient->GetVertOrient(),
@@ -1062,7 +1062,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 
         case RES_FRM_SIZE:
         {
-            SwFmtFrmSize* pFrmSize = PTR_CAST(SwFmtFrmSize, &rItem);
+            const SwFmtFrmSize* pFrmSize = PTR_CAST(SwFmtFrmSize, &rItem);
             OSL_ENSURE( pFrmSize != NULL, "Wrong Which-ID" );
 
             bool bOutHeight = false;
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index a235761..8b359b6 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -1044,10 +1044,10 @@ bool SwXMLImport::FindAutomaticStyle(
     SwXMLItemSetStyleContext_Impl *pStyle = 0;
     if( GetAutoStyles() )
     {
-        pStyle = PTR_CAST( SwXMLItemSetStyleContext_Impl,
+        pStyle = const_cast<SwXMLItemSetStyleContext_Impl*>(PTR_CAST( 
SwXMLItemSetStyleContext_Impl,
               GetAutoStyles()->
                     FindStyleChildContext( nFamily, rName,
-                                           true ) );
+                                           true ) ) );
         if( pStyle )
         {
             if( ppItemSet )
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index c956ac2..274d116 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -288,7 +288,7 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
                 break;
 
             case DBG_FUNC_SETTESTSOLARMUTEX:
-                pDebugData->pDbgTestSolarMutex = 
(DbgTestSolarMutexProc)(long)pParam;
+                pDebugData->pDbgTestSolarMutex = 
reinterpret_cast<DbgTestSolarMutexProc>(reinterpret_cast<long>(pParam));
                 break;
 
             case DBG_FUNC_TESTSOLARMUTEX:
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index e5ed7f2..aaa780f 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -310,7 +310,7 @@ inline double ImplGetParameter( const Point& rCenter, const 
Point& rPt, double f
 
 Polygon::Polygon()
 {
-    mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+    mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
 }
 
 Polygon::Polygon( sal_uInt16 nSize )
@@ -319,7 +319,7 @@ Polygon::Polygon( sal_uInt16 nSize )
     if ( nSize )
         mpImplPolygon = new ImplPolygon( nSize );
     else
-        mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+        mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
 }
 
 Polygon::Polygon( sal_uInt16 nPoints, const Point* pPtAry, const sal_uInt8* 
pFlagAry )
@@ -328,7 +328,7 @@ Polygon::Polygon( sal_uInt16 nPoints, const Point* pPtAry, 
const sal_uInt8* pFla
     if( nPoints )
         mpImplPolygon = new ImplPolygon( nPoints, pPtAry, pFlagAry );
     else
-        mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+        mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
 }
 
 Polygon::Polygon( const Polygon& rPoly )
@@ -344,7 +344,7 @@ Polygon::Polygon( const Rectangle& rRect )
 {
 
     if ( rRect.IsEmpty() )
-        mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+        mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
     else
     {
         mpImplPolygon = new ImplPolygon( 5 );
@@ -359,7 +359,7 @@ Polygon::Polygon( const Rectangle& rRect )
 Polygon::Polygon( const Rectangle& rRect, sal_uIntPtr nHorzRound, sal_uIntPtr 
nVertRound )
 {
     if ( rRect.IsEmpty() )
-        mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+        mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
     else
     {
         Rectangle aRect( rRect );
@@ -455,7 +455,7 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long 
nRadY, sal_uInt16 nPoin
         }
     }
     else
-        mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+        mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
 }
 
 Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& 
rEnd,
@@ -530,7 +530,7 @@ Polygon::Polygon( const Rectangle& rBound, const Point& 
rStart, const Point& rEn
             mpImplPolygon->mpPointAry[ nPoints ] = mpImplPolygon->mpPointAry[ 
0 ];
     }
     else
-        mpImplPolygon = (ImplPolygon*) &aStaticImplPolygon;
+        mpImplPolygon = static_cast<ImplPolygon*>( &aStaticImplPolygon );
 }
 
 Polygon::Polygon( const Point& rBezPt1, const Point& rCtrlPt1,
@@ -677,7 +677,7 @@ void Polygon::Clear()
             delete mpImplPolygon;
     }
 
-    mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+    mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
 }
 
 double Polygon::CalcDistance( sal_uInt16 nP1, sal_uInt16 nP2 )
@@ -1934,7 +1934,7 @@ Polygon::Polygon(const basegfx::B2DPolygon& rPolygon)
     if(!mpImplPolygon)
     {
         // no content yet, create empty polygon
-        mpImplPolygon = (ImplPolygon*)(&aStaticImplPolygon);
+        mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
     }
 }
 
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index b3cd18e..652f420 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -1234,9 +1234,9 @@ sal_uInt32 ResMgr::GetRemainSize()
         return pFallbackResMgr->GetRemainSize();
 
     const ImpRCStack& rTop = aStack[nCurStack];
-    return  (sal_uInt32)((sal_IntPtr)(sal_uInt8 *)rTop.pResource +
-                     rTop.pResource->GetLocalOff() -
-                     (sal_IntPtr)(sal_uInt8 *)rTop.pClassRes);
+    return (sal_uInt32)(reinterpret_cast<sal_IntPtr>(rTop.pResource) +
+                        rTop.pResource->GetLocalOff() -
+                        reinterpret_cast<sal_IntPtr>(rTop.pClassRes));
 }
 
 void* ResMgr::Increment( sal_uInt32 nSize )
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 3a45d57..f5595f7 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -639,7 +639,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = 
true */)
 
             if( pStyle && pStyle->ISA(XMLShapeStyleContext) )
             {
-                pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle );
+                pDocStyle = const_cast<XMLShapeStyleContext*>(PTR_CAST( 
XMLShapeStyleContext, pStyle ));
 
                 if( pDocStyle->GetStyle().is() )
                 {
@@ -735,7 +735,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = 
true */)
                 break;
 
             const SvXMLStyleContext* pTempStyle = 
GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH,
 maTextStyleName);
-            XMLPropStyleContext* pStyle = PTR_CAST( XMLPropStyleContext, 
pTempStyle ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext 
will be called twice
+            XMLPropStyleContext* pStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST( XMLPropStyleContext, pTempStyle )); 
// use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called 
twice
             if( pStyle == NULL )
                 break;
 
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index b1e4c03..83c2c48 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -222,7 +222,7 @@ void SdXMLDrawingPageStyleContext::Finish( bool bOverwrite )
 
                 sal_Int32 nStyle = 0;
 
-                SdXMLNumberFormatImportContext* pSdNumStyle =
+                const SdXMLNumberFormatImportContext* pSdNumStyle =
                     PTR_CAST( SdXMLNumberFormatImportContext,
                         GetStyles()->FindStyleChildContext( 
XML_STYLE_FAMILY_DATA_STYLE, sStyleName, true ) );
 
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index 62ea125..1668132 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1435,7 +1435,7 @@ void XMLTextFrameContext::EndElement()
 
     SvXMLImportContext const*const pContext =
         (pMultiContext) ? &pMultiContext : &m_xImplContext;
-    XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, 
pContext );
+    XMLTextFrameContext_Impl *pImpl = 
const_cast<XMLTextFrameContext_Impl*>(PTR_CAST( XMLTextFrameContext_Impl, 
pContext ));
     assert(!pMultiContext || pImpl);
     if( pImpl )
     {
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 297b871..5275667 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1224,7 +1224,7 @@ OUString XMLTextImportHelper::ConvertStarFonts( const 
OUString& rChars,
                         ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
                                 FindStyleChildContext( nFamily, rStyleName,
                                                        true );
-                    pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle);
+                    pStyle = const_cast<XMLTextStyleContext*>(PTR_CAST( 
XMLTextStyleContext,pTempStyle));
                 }
 
                 if( pStyle )
@@ -1433,7 +1433,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
         const SvXMLStyleContext* pTempStyle =
             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
                     FindStyleChildContext( nFamily, sStyleName, true );
-        pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle);
+        pStyle = const_cast<XMLTextStyleContext*>(PTR_CAST( 
XMLTextStyleContext,pTempStyle));
     }
     if( pStyle )
         sStyleName = pStyle->GetParentName();
@@ -2120,7 +2120,7 @@ void XMLTextImportHelper::SetRuby(
                 ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
                 FindStyleChildContext( XML_STYLE_FAMILY_TEXT_RUBY,
                                        rStyleName, true );
-            pStyle = PTR_CAST(XMLPropStyleContext,pTempStyle);
+            pStyle = 
const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pTempStyle));
 
             if (NULL != pStyle)
                 pStyle->FillPropertySet( xPropSet );
@@ -2361,14 +2361,14 @@ sal_Int32 XMLTextImportHelper::GetDataStyleKey(const 
OUString& sStyleName,
     // first check if it's a impress and draw only number format
     // this is needed since its also a SvXMLNumFormatContext,
     // that was needed to support them for controls in impress/draw also
-    SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( 
SdXMLNumberFormatImportContext, pStyle );
+    const SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( 
SdXMLNumberFormatImportContext, pStyle );
     if( pSdNumStyle )
     {
         return pSdNumStyle->GetDrawKey();
     }
     else
     {
-        SvXMLNumFormatContext* pNumStyle = PTR_CAST( SvXMLNumFormatContext, 
pStyle );
+        SvXMLNumFormatContext* pNumStyle = 
const_cast<SvXMLNumFormatContext*>(PTR_CAST( SvXMLNumFormatContext, pStyle ));
         if( pNumStyle )
         {
             if( pIsSystemLanguage != NULL )
@@ -2405,7 +2405,7 @@ XMLPropStyleContext 
*XMLTextImportHelper::FindAutoFrameStyle( const OUString& rN
             ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)->
                     FindStyleChildContext( XML_STYLE_FAMILY_SD_GRAPHICS_ID, 
rName,
                                            true );
-        pStyle = PTR_CAST( XMLPropStyleContext ,pTempStyle);
+        pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( 
XMLPropStyleContext ,pTempStyle));
     }
 
     return pStyle;
@@ -2422,7 +2422,7 @@ XMLPropStyleContext* 
XMLTextImportHelper::FindSectionStyle(
                            FindStyleChildContext(
                                XML_STYLE_FAMILY_TEXT_SECTION,
                                rName, true );
-        pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle);
+        pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( 
XMLPropStyleContext,pTempStyle));
     }
 
     return pStyle;
@@ -2439,7 +2439,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindPageMaster(
                            FindStyleChildContext(
                                XML_STYLE_FAMILY_PAGE_MASTER,
                                rName, true );
-        pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle);
+        pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( 
XMLPropStyleContext,pTempStyle));
     }
 
     return pStyle;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to